update vendor

This commit is contained in:
rainzm
2021-05-28 15:18:35 +08:00
parent 00f94399fb
commit 928a801c87
320 changed files with 29972 additions and 0 deletions

15
vendor/github.com/gofrs/uuid/.gitignore generated vendored Normal file
View File

@@ -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

23
vendor/github.com/gofrs/uuid/.travis.yml generated vendored Normal file
View File

@@ -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

20
vendor/github.com/gofrs/uuid/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,20 @@
Copyright (C) 2013-2018 by Maxim Bublis <b@codemonkey.ru>
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.

109
vendor/github.com/gofrs/uuid/README.md generated vendored Normal file
View File

@@ -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)

212
vendor/github.com/gofrs/uuid/codec.go generated vendored Normal file
View File

@@ -0,0 +1,212 @@
// Copyright (C) 2013-2018 by Maxim Bublis <b@codemonkey.ru>
//
// 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
}

47
vendor/github.com/gofrs/uuid/fuzz.go generated vendored Normal file
View File

@@ -0,0 +1,47 @@
// Copyright (c) 2018 Andrei Tudor Călin <mail@acln.ro>
//
// 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
}

299
vendor/github.com/gofrs/uuid/generator.go generated vendored Normal file
View File

@@ -0,0 +1,299 @@
// Copyright (C) 2013-2018 by Maxim Bublis <b@codemonkey.ru>
//
// 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")
}

109
vendor/github.com/gofrs/uuid/sql.go generated vendored Normal file
View File

@@ -0,0 +1,109 @@
// Copyright (C) 2013-2018 by Maxim Bublis <b@codemonkey.ru>
//
// 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
}

189
vendor/github.com/gofrs/uuid/uuid.go generated vendored Normal file
View File

@@ -0,0 +1,189 @@
// Copyright (C) 2013-2018 by Maxim Bublis <b@codemonkey.ru>
//
// 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
}

201
vendor/github.com/jdcloud-api/jdcloud-sdk-go/LICENSE generated vendored Normal file
View File

@@ -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.

View File

@@ -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
}

View File

@@ -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"
)

View File

@@ -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}
}

View File

@@ -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

View File

@@ -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"`
}

View File

@@ -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)
}
}

View File

@@ -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
}

View File

@@ -0,0 +1,52 @@
// 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...)
}
}
type DummyLogger struct {
}
func NewDummyLogger() *DummyLogger {
return &DummyLogger{}
}
func (logger DummyLogger) Log (level int, message... interface{}) {
}

View File

@@ -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, &paramMap)
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, &paramMap)
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, &paramMap)
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
}

View File

@@ -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")
}

View File

@@ -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 muliple 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()
}

View File

@@ -0,0 +1,11 @@
package core
func includes(fields []string, field string) bool {
for _, v := range fields {
if v == field {
return true
}
}
return false
}

View File

@@ -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.5"

View File

@@ -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_durationpostpaid_by_usage或postpaid_by_durationprepaid_by_duration表示预付费postpaid_by_usage表示按用量后付费postpaid_by_duration表示按配置后付费默认为postpaid_by_duration (Optional) */
ChargeMode string `json:"chargeMode"`
/* 费用支付状态取值为normal、overdue、arrearnormal表示正常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"`
}

View File

@@ -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 ChargeSpec struct {
/* 计费模式取值为prepaid_by_durationpostpaid_by_usage或postpaid_by_durationprepaid_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"`
/* True=OPEN——开通自动续费、False=CLOSE—— 不开通自动续费默认为CLOSE (Optional) */
AutoRenew *bool `json:"autoRenew"`
/* 产品线统一活动凭证JSON字符串需要BASE64编码目前要求编码前格式为 {"activity":{"activityType":必填字段, "activityIdentifier":必填字段}} (Optional) */
BuyScenario *string `json:"buyScenario"`
}

View File

@@ -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 BatchResultDetail struct {
/* 操作成功的资源个数 (Optional) */
SuccessCount int `json:"successCount"`
/* 操作失败的资源及原因 (Optional) */
Failed []ErrorItem `json:"failed"`
}

View File

@@ -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 Err struct {
/* 同http code (Optional) */
Code int64 `json:"code"`
/* (Optional) */
Details interface{} `json:"details"`
/* (Optional) */
Message string `json:"message"`
/* 具体错误 (Optional) */
Status string `json:"status"`
}

View File

@@ -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 ErrorItem struct {
/* 出错资源ID (Optional) */
Id string `json:"id"`
/* 错误码同标准code (Optional) */
Code int64 `json:"code"`
/* (Optional) */
Details interface{} `json:"details"`
/* (Optional) */
Message string `json:"message"`
/* 具体错误同标准status (Optional) */
Status string `json:"status"`
}

View File

@@ -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"`
}

View File

@@ -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"`
}

View File

@@ -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"`
}

View File

@@ -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"`
}

View File

@@ -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"`
}

View File

@@ -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"
disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models"
)
type ApplySnapshotPoliciesRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 绑定/解绑操作 (Optional) */
Relations []disk.PolicyDiskRelationOp `json:"relations"`
}
/*
* param regionId: 地域ID (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewApplySnapshotPoliciesRequest(
regionId string,
) *ApplySnapshotPoliciesRequest {
return &ApplySnapshotPoliciesRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicies:apply",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
}
}
/*
* param regionId: 地域ID (Required)
* param relations: 绑定/解绑操作 (Optional)
*/
func NewApplySnapshotPoliciesRequestWithAllParams(
regionId string,
relations []disk.PolicyDiskRelationOp,
) *ApplySnapshotPoliciesRequest {
return &ApplySnapshotPoliciesRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicies:apply",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
Relations: relations,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewApplySnapshotPoliciesRequestWithoutParam() *ApplySnapshotPoliciesRequest {
return &ApplySnapshotPoliciesRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicies:apply",
Method: "POST",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *ApplySnapshotPoliciesRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param relations: 绑定/解绑操作(Optional) */
func (r *ApplySnapshotPoliciesRequest) SetRelations(relations []disk.PolicyDiskRelationOp) {
r.Relations = relations
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r ApplySnapshotPoliciesRequest) GetRegionId() string {
return r.RegionId
}
type ApplySnapshotPoliciesResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result ApplySnapshotPoliciesResult `json:"result"`
}
type ApplySnapshotPoliciesResult struct {
OpResults []disk.PolicyDiskRelationOpResult `json:"opResults"`
}

View File

@@ -0,0 +1,157 @@
// 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"
disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models"
)
type CreateDisksRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 创建云硬盘规格 */
DiskSpec *disk.DiskSpec `json:"diskSpec"`
/* 购买实例数量;取值范围:[1,100] */
MaxCount int `json:"maxCount"`
/* 用户标签 (Optional) */
UserTags []disk.Tag `json:"userTags"`
/* 幂等性校验参数 */
ClientToken string `json:"clientToken"`
}
/*
* param regionId: 地域ID (Required)
* param diskSpec: 创建云硬盘规格 (Required)
* param maxCount: 购买实例数量;取值范围:[1,100] (Required)
* param clientToken: 幂等性校验参数 (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewCreateDisksRequest(
regionId string,
diskSpec *disk.DiskSpec,
maxCount int,
clientToken string,
) *CreateDisksRequest {
return &CreateDisksRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
DiskSpec: diskSpec,
MaxCount: maxCount,
ClientToken: clientToken,
}
}
/*
* param regionId: 地域ID (Required)
* param diskSpec: 创建云硬盘规格 (Required)
* param maxCount: 购买实例数量;取值范围:[1,100] (Required)
* param userTags: 用户标签 (Optional)
* param clientToken: 幂等性校验参数 (Required)
*/
func NewCreateDisksRequestWithAllParams(
regionId string,
diskSpec *disk.DiskSpec,
maxCount int,
userTags []disk.Tag,
clientToken string,
) *CreateDisksRequest {
return &CreateDisksRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
DiskSpec: diskSpec,
MaxCount: maxCount,
UserTags: userTags,
ClientToken: clientToken,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewCreateDisksRequestWithoutParam() *CreateDisksRequest {
return &CreateDisksRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks",
Method: "POST",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *CreateDisksRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param diskSpec: 创建云硬盘规格(Required) */
func (r *CreateDisksRequest) SetDiskSpec(diskSpec *disk.DiskSpec) {
r.DiskSpec = diskSpec
}
/* param maxCount: 购买实例数量;取值范围:[1,100](Required) */
func (r *CreateDisksRequest) SetMaxCount(maxCount int) {
r.MaxCount = maxCount
}
/* param userTags: 用户标签(Optional) */
func (r *CreateDisksRequest) SetUserTags(userTags []disk.Tag) {
r.UserTags = userTags
}
/* param clientToken: 幂等性校验参数(Required) */
func (r *CreateDisksRequest) SetClientToken(clientToken string) {
r.ClientToken = clientToken
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r CreateDisksRequest) GetRegionId() string {
return r.RegionId
}
type CreateDisksResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result CreateDisksResult `json:"result"`
}
type CreateDisksResult struct {
PolicyRelations []disk.PolicyDiskRelationOpResult `json:"policyRelations"`
DiskIds []string `json:"diskIds"`
Tagmsg string `json:"tagmsg"`
}

View File

@@ -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"
disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models"
)
type CreateSnapshotRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 创建快照规格 */
SnapshotSpec *disk.SnapshotSpec `json:"snapshotSpec"`
/* 幂等性校验参数 */
ClientToken string `json:"clientToken"`
}
/*
* param regionId: 地域ID (Required)
* param snapshotSpec: 创建快照规格 (Required)
* param clientToken: 幂等性校验参数 (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewCreateSnapshotRequest(
regionId string,
snapshotSpec *disk.SnapshotSpec,
clientToken string,
) *CreateSnapshotRequest {
return &CreateSnapshotRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
SnapshotSpec: snapshotSpec,
ClientToken: clientToken,
}
}
/*
* param regionId: 地域ID (Required)
* param snapshotSpec: 创建快照规格 (Required)
* param clientToken: 幂等性校验参数 (Required)
*/
func NewCreateSnapshotRequestWithAllParams(
regionId string,
snapshotSpec *disk.SnapshotSpec,
clientToken string,
) *CreateSnapshotRequest {
return &CreateSnapshotRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
SnapshotSpec: snapshotSpec,
ClientToken: clientToken,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewCreateSnapshotRequestWithoutParam() *CreateSnapshotRequest {
return &CreateSnapshotRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots",
Method: "POST",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *CreateSnapshotRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param snapshotSpec: 创建快照规格(Required) */
func (r *CreateSnapshotRequest) SetSnapshotSpec(snapshotSpec *disk.SnapshotSpec) {
r.SnapshotSpec = snapshotSpec
}
/* param clientToken: 幂等性校验参数(Required) */
func (r *CreateSnapshotRequest) SetClientToken(clientToken string) {
r.ClientToken = clientToken
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r CreateSnapshotRequest) GetRegionId() string {
return r.RegionId
}
type CreateSnapshotResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result CreateSnapshotResult `json:"result"`
}
type CreateSnapshotResult struct {
SnapshotId string `json:"snapshotId"`
}

View File

@@ -0,0 +1,195 @@
// 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"
disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models"
)
type CreateSnapshotPolicyRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 策略名称 */
Name string `json:"name"`
/* 策略执行周期,单位:秒不小于12小时 */
Interval int `json:"interval"`
/* 策略生效时间,格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00` */
EffectiveTime string `json:"effectiveTime"`
/* 快照保留时间,单位:秒0:表示不删除 */
SnapshotLifecycle int `json:"snapshotLifecycle"`
/* 联系人信息 (Optional) */
ContactInfo *disk.ContactInfo `json:"contactInfo"`
/* 策略状态。1:启用 2:禁用 */
Status int `json:"status"`
}
/*
* param regionId: 地域ID (Required)
* param name: 策略名称 (Required)
* param interval: 策略执行周期,单位:秒不小于12小时 (Required)
* param effectiveTime: 策略生效时间,格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00` (Required)
* param snapshotLifecycle: 快照保留时间,单位:秒0:表示不删除 (Required)
* param status: 策略状态。1:启用 2:禁用 (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewCreateSnapshotPolicyRequest(
regionId string,
name string,
interval int,
effectiveTime string,
snapshotLifecycle int,
status int,
) *CreateSnapshotPolicyRequest {
return &CreateSnapshotPolicyRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicy",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
Name: name,
Interval: interval,
EffectiveTime: effectiveTime,
SnapshotLifecycle: snapshotLifecycle,
Status: status,
}
}
/*
* param regionId: 地域ID (Required)
* param name: 策略名称 (Required)
* param interval: 策略执行周期,单位:秒不小于12小时 (Required)
* param effectiveTime: 策略生效时间,格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00` (Required)
* param snapshotLifecycle: 快照保留时间,单位:秒0:表示不删除 (Required)
* param contactInfo: 联系人信息 (Optional)
* param status: 策略状态。1:启用 2:禁用 (Required)
*/
func NewCreateSnapshotPolicyRequestWithAllParams(
regionId string,
name string,
interval int,
effectiveTime string,
snapshotLifecycle int,
contactInfo *disk.ContactInfo,
status int,
) *CreateSnapshotPolicyRequest {
return &CreateSnapshotPolicyRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicy",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
Name: name,
Interval: interval,
EffectiveTime: effectiveTime,
SnapshotLifecycle: snapshotLifecycle,
ContactInfo: contactInfo,
Status: status,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewCreateSnapshotPolicyRequestWithoutParam() *CreateSnapshotPolicyRequest {
return &CreateSnapshotPolicyRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicy",
Method: "POST",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *CreateSnapshotPolicyRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param name: 策略名称(Required) */
func (r *CreateSnapshotPolicyRequest) SetName(name string) {
r.Name = name
}
/* param interval: 策略执行周期,单位:秒不小于12小时(Required) */
func (r *CreateSnapshotPolicyRequest) SetInterval(interval int) {
r.Interval = interval
}
/* param effectiveTime: 策略生效时间,格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00`(Required) */
func (r *CreateSnapshotPolicyRequest) SetEffectiveTime(effectiveTime string) {
r.EffectiveTime = effectiveTime
}
/* param snapshotLifecycle: 快照保留时间,单位:秒0:表示不删除(Required) */
func (r *CreateSnapshotPolicyRequest) SetSnapshotLifecycle(snapshotLifecycle int) {
r.SnapshotLifecycle = snapshotLifecycle
}
/* param contactInfo: 联系人信息(Optional) */
func (r *CreateSnapshotPolicyRequest) SetContactInfo(contactInfo *disk.ContactInfo) {
r.ContactInfo = contactInfo
}
/* param status: 策略状态。1:启用 2:禁用(Required) */
func (r *CreateSnapshotPolicyRequest) SetStatus(status int) {
r.Status = status
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r CreateSnapshotPolicyRequest) GetRegionId() string {
return r.RegionId
}
type CreateSnapshotPolicyResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result CreateSnapshotPolicyResult `json:"result"`
}
type CreateSnapshotPolicyResult struct {
Id string `json:"id"`
Name string `json:"name"`
Pin string `json:"pin"`
Interval int `json:"interval"`
EffectiveTime string `json:"effectiveTime"`
LastTriggerTime string `json:"lastTriggerTime"`
NextTriggerTime string `json:"nextTriggerTime"`
SnapshotLifecycle int `json:"snapshotLifecycle"`
ContactInfo disk.ContactInfo `json:"contactInfo"`
CreateTime string `json:"createTime"`
UpdateTime string `json:"updateTime"`
Status int `json:"status"`
DiskCount int `json:"diskCount"`
}

View File

@@ -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 DeleteDiskRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 云硬盘ID */
DiskId string `json:"diskId"`
}
/*
* param regionId: 地域ID (Required)
* param diskId: 云硬盘ID (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewDeleteDiskRequest(
regionId string,
diskId string,
) *DeleteDiskRequest {
return &DeleteDiskRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks/{diskId}",
Method: "DELETE",
Header: nil,
Version: "v1",
},
RegionId: regionId,
DiskId: diskId,
}
}
/*
* param regionId: 地域ID (Required)
* param diskId: 云硬盘ID (Required)
*/
func NewDeleteDiskRequestWithAllParams(
regionId string,
diskId string,
) *DeleteDiskRequest {
return &DeleteDiskRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks/{diskId}",
Method: "DELETE",
Header: nil,
Version: "v1",
},
RegionId: regionId,
DiskId: diskId,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewDeleteDiskRequestWithoutParam() *DeleteDiskRequest {
return &DeleteDiskRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks/{diskId}",
Method: "DELETE",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *DeleteDiskRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param diskId: 云硬盘ID(Required) */
func (r *DeleteDiskRequest) SetDiskId(diskId string) {
r.DiskId = diskId
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r DeleteDiskRequest) GetRegionId() string {
return r.RegionId
}
type DeleteDiskResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result DeleteDiskResult `json:"result"`
}
type DeleteDiskResult struct {
}

View File

@@ -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 DeleteSnapshotRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 快照ID */
SnapshotId string `json:"snapshotId"`
}
/*
* param regionId: 地域ID (Required)
* param snapshotId: 快照ID (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewDeleteSnapshotRequest(
regionId string,
snapshotId string,
) *DeleteSnapshotRequest {
return &DeleteSnapshotRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots/{snapshotId}",
Method: "DELETE",
Header: nil,
Version: "v1",
},
RegionId: regionId,
SnapshotId: snapshotId,
}
}
/*
* param regionId: 地域ID (Required)
* param snapshotId: 快照ID (Required)
*/
func NewDeleteSnapshotRequestWithAllParams(
regionId string,
snapshotId string,
) *DeleteSnapshotRequest {
return &DeleteSnapshotRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots/{snapshotId}",
Method: "DELETE",
Header: nil,
Version: "v1",
},
RegionId: regionId,
SnapshotId: snapshotId,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewDeleteSnapshotRequestWithoutParam() *DeleteSnapshotRequest {
return &DeleteSnapshotRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots/{snapshotId}",
Method: "DELETE",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *DeleteSnapshotRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param snapshotId: 快照ID(Required) */
func (r *DeleteSnapshotRequest) SetSnapshotId(snapshotId string) {
r.SnapshotId = snapshotId
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r DeleteSnapshotRequest) GetRegionId() string {
return r.RegionId
}
type DeleteSnapshotResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result DeleteSnapshotResult `json:"result"`
}
type DeleteSnapshotResult struct {
}

View File

@@ -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 DeleteSnapshotPolicyRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 策略ID */
PolicyId string `json:"policyId"`
}
/*
* param regionId: 地域ID (Required)
* param policyId: 策略ID (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewDeleteSnapshotPolicyRequest(
regionId string,
policyId string,
) *DeleteSnapshotPolicyRequest {
return &DeleteSnapshotPolicyRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicy/{policyId}",
Method: "DELETE",
Header: nil,
Version: "v1",
},
RegionId: regionId,
PolicyId: policyId,
}
}
/*
* param regionId: 地域ID (Required)
* param policyId: 策略ID (Required)
*/
func NewDeleteSnapshotPolicyRequestWithAllParams(
regionId string,
policyId string,
) *DeleteSnapshotPolicyRequest {
return &DeleteSnapshotPolicyRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicy/{policyId}",
Method: "DELETE",
Header: nil,
Version: "v1",
},
RegionId: regionId,
PolicyId: policyId,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewDeleteSnapshotPolicyRequestWithoutParam() *DeleteSnapshotPolicyRequest {
return &DeleteSnapshotPolicyRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicy/{policyId}",
Method: "DELETE",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *DeleteSnapshotPolicyRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param policyId: 策略ID(Required) */
func (r *DeleteSnapshotPolicyRequest) SetPolicyId(policyId string) {
r.PolicyId = policyId
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r DeleteSnapshotPolicyRequest) GetRegionId() string {
return r.RegionId
}
type DeleteSnapshotPolicyResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result DeleteSnapshotPolicyResult `json:"result"`
}
type DeleteSnapshotPolicyResult struct {
}

View File

@@ -0,0 +1,118 @@
// 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"
disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models"
)
type DeleteSnapshotsRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 快照ID列表 */
SnapshotIds []string `json:"snapshotIds"`
}
/*
* param regionId: 地域ID (Required)
* param snapshotIds: 快照ID列表 (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewDeleteSnapshotsRequest(
regionId string,
snapshotIds []string,
) *DeleteSnapshotsRequest {
return &DeleteSnapshotsRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots",
Method: "DELETE",
Header: nil,
Version: "v1",
},
RegionId: regionId,
SnapshotIds: snapshotIds,
}
}
/*
* param regionId: 地域ID (Required)
* param snapshotIds: 快照ID列表 (Required)
*/
func NewDeleteSnapshotsRequestWithAllParams(
regionId string,
snapshotIds []string,
) *DeleteSnapshotsRequest {
return &DeleteSnapshotsRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots",
Method: "DELETE",
Header: nil,
Version: "v1",
},
RegionId: regionId,
SnapshotIds: snapshotIds,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewDeleteSnapshotsRequestWithoutParam() *DeleteSnapshotsRequest {
return &DeleteSnapshotsRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots",
Method: "DELETE",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *DeleteSnapshotsRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param snapshotIds: 快照ID列表(Required) */
func (r *DeleteSnapshotsRequest) SetSnapshotIds(snapshotIds []string) {
r.SnapshotIds = snapshotIds
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r DeleteSnapshotsRequest) GetRegionId() string {
return r.RegionId
}
type DeleteSnapshotsResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result DeleteSnapshotsResult `json:"result"`
}
type DeleteSnapshotsResult struct {
Snapshots []disk.DelSnapshot `json:"snapshots"`
SuccessCount int `json:"successCount"`
FailedCount int `json:"failedCount"`
}

View File

@@ -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"
disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models"
)
type DescribeDiskRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 云硬盘ID */
DiskId string `json:"diskId"`
}
/*
* param regionId: 地域ID (Required)
* param diskId: 云硬盘ID (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewDescribeDiskRequest(
regionId string,
diskId string,
) *DescribeDiskRequest {
return &DescribeDiskRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks/{diskId}",
Method: "GET",
Header: nil,
Version: "v1",
},
RegionId: regionId,
DiskId: diskId,
}
}
/*
* param regionId: 地域ID (Required)
* param diskId: 云硬盘ID (Required)
*/
func NewDescribeDiskRequestWithAllParams(
regionId string,
diskId string,
) *DescribeDiskRequest {
return &DescribeDiskRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks/{diskId}",
Method: "GET",
Header: nil,
Version: "v1",
},
RegionId: regionId,
DiskId: diskId,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewDescribeDiskRequestWithoutParam() *DescribeDiskRequest {
return &DescribeDiskRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks/{diskId}",
Method: "GET",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *DescribeDiskRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param diskId: 云硬盘ID(Required) */
func (r *DescribeDiskRequest) SetDiskId(diskId string) {
r.DiskId = diskId
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r DescribeDiskRequest) GetRegionId() string {
return r.RegionId
}
type DescribeDiskResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result DescribeDiskResult `json:"result"`
}
type DescribeDiskResult struct {
Disk disk.Disk `json:"disk"`
}

View File

@@ -0,0 +1,181 @@
// 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"
disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models"
common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models"
)
type DescribeDisksRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 页码, 默认为1, 取值范围:[1,∞) (Optional) */
PageNumber *int `json:"pageNumber"`
/* 分页大小默认为20取值范围[10,100] (Optional) */
PageSize *int `json:"pageSize"`
/* Tag筛选条件 (Optional) */
Tags []disk.TagFilter `json:"tags"`
/* diskId - 云硬盘ID精确匹配支持多个
diskType - 云硬盘类型,精确匹配,支持多个,取值为 ssd,premium-hdd,ssd.io1,ssd.gp1,hdd.std1
instanceId - 云硬盘所挂载主机的ID精确匹配支持多个
instanceType - 云硬盘所挂载主机的类型,精确匹配,支持多个
status - 可用区,精确匹配,支持多个
az - 云硬盘状态,精确匹配,支持多个
name - 云硬盘名称,模糊匹配,支持单个
multiAttach - 云硬盘是否多点挂载,精确匹配,支持单个
encrypted - 云硬盘是否加密,精确匹配,支持单个
policyId - 绑定policyId的云硬盘精确匹配支持多个
notPolicyId - 未绑定policyId的云硬盘精确匹配支持多个
(Optional) */
Filters []common.Filter `json:"filters"`
}
/*
* param regionId: 地域ID (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewDescribeDisksRequest(
regionId string,
) *DescribeDisksRequest {
return &DescribeDisksRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks",
Method: "GET",
Header: nil,
Version: "v1",
},
RegionId: regionId,
}
}
/*
* param regionId: 地域ID (Required)
* param pageNumber: 页码, 默认为1, 取值范围:[1,∞) (Optional)
* param pageSize: 分页大小默认为20取值范围[10,100] (Optional)
* param tags: Tag筛选条件 (Optional)
* param filters: diskId - 云硬盘ID精确匹配支持多个
diskType - 云硬盘类型,精确匹配,支持多个,取值为 ssd,premium-hdd,ssd.io1,ssd.gp1,hdd.std1
instanceId - 云硬盘所挂载主机的ID精确匹配支持多个
instanceType - 云硬盘所挂载主机的类型,精确匹配,支持多个
status - 可用区,精确匹配,支持多个
az - 云硬盘状态,精确匹配,支持多个
name - 云硬盘名称,模糊匹配,支持单个
multiAttach - 云硬盘是否多点挂载,精确匹配,支持单个
encrypted - 云硬盘是否加密,精确匹配,支持单个
policyId - 绑定policyId的云硬盘精确匹配支持多个
notPolicyId - 未绑定policyId的云硬盘精确匹配支持多个
(Optional)
*/
func NewDescribeDisksRequestWithAllParams(
regionId string,
pageNumber *int,
pageSize *int,
tags []disk.TagFilter,
filters []common.Filter,
) *DescribeDisksRequest {
return &DescribeDisksRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks",
Method: "GET",
Header: nil,
Version: "v1",
},
RegionId: regionId,
PageNumber: pageNumber,
PageSize: pageSize,
Tags: tags,
Filters: filters,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewDescribeDisksRequestWithoutParam() *DescribeDisksRequest {
return &DescribeDisksRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks",
Method: "GET",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *DescribeDisksRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param pageNumber: 页码, 默认为1, 取值范围:[1,∞)(Optional) */
func (r *DescribeDisksRequest) SetPageNumber(pageNumber int) {
r.PageNumber = &pageNumber
}
/* param pageSize: 分页大小默认为20取值范围[10,100](Optional) */
func (r *DescribeDisksRequest) SetPageSize(pageSize int) {
r.PageSize = &pageSize
}
/* param tags: Tag筛选条件(Optional) */
func (r *DescribeDisksRequest) SetTags(tags []disk.TagFilter) {
r.Tags = tags
}
/* param filters: diskId - 云硬盘ID精确匹配支持多个
diskType - 云硬盘类型,精确匹配,支持多个,取值为 ssd,premium-hdd,ssd.io1,ssd.gp1,hdd.std1
instanceId - 云硬盘所挂载主机的ID精确匹配支持多个
instanceType - 云硬盘所挂载主机的类型,精确匹配,支持多个
status - 可用区,精确匹配,支持多个
az - 云硬盘状态,精确匹配,支持多个
name - 云硬盘名称,模糊匹配,支持单个
multiAttach - 云硬盘是否多点挂载,精确匹配,支持单个
encrypted - 云硬盘是否加密,精确匹配,支持单个
policyId - 绑定policyId的云硬盘精确匹配支持多个
notPolicyId - 未绑定policyId的云硬盘精确匹配支持多个
(Optional) */
func (r *DescribeDisksRequest) SetFilters(filters []common.Filter) {
r.Filters = filters
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r DescribeDisksRequest) GetRegionId() string {
return r.RegionId
}
type DescribeDisksResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result DescribeDisksResult `json:"result"`
}
type DescribeDisksResult struct {
Disks []disk.Disk `json:"disks"`
TotalCount int `json:"totalCount"`
}

View File

@@ -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"
disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models"
)
type DescribeQuotaRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 资源类型 disk用户能创建的云盘的配额 snapshot 用户能创建的快照的配额 snapshot_policy 用户能创建的快照策略的配额 */
Type string `json:"type"`
}
/*
* param regionId: 地域ID (Required)
* param type_: 资源类型 disk用户能创建的云盘的配额 snapshot 用户能创建的快照的配额 snapshot_policy 用户能创建的快照策略的配额 (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: 地域ID (Required)
* param type_: 资源类型 disk用户能创建的云盘的配额 snapshot 用户能创建的快照的配额 snapshot_policy 用户能创建的快照策略的配额 (Required)
*/
func NewDescribeQuotaRequestWithAllParams(
regionId string,
type_ string,
) *DescribeQuotaRequest {
return &DescribeQuotaRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/quotas",
Method: "GET",
Header: nil,
Version: "v1",
},
RegionId: regionId,
Type: type_,
}
}
/* 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: 地域ID(Required) */
func (r *DescribeQuotaRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param type_: 资源类型 disk用户能创建的云盘的配额 snapshot 用户能创建的快照的配额 snapshot_policy 用户能创建的快照策略的配额(Required) */
func (r *DescribeQuotaRequest) SetType(type_ string) {
r.Type = type_
}
// 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 disk.Quota `json:"quota"`
}

View File

@@ -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"
disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models"
)
type DescribeSnapPolicesRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 过滤条件 (Optional) */
FilterGroups []disk.FilterGroups `json:"filterGroups"`
/* 排序字段只支持create_time和update_time字段 (Optional) */
Order *disk.OrderItem `json:"order"`
/* 页码, 默认为1, 取值范围:[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 NewDescribeSnapPolicesRequest(
regionId string,
) *DescribeSnapPolicesRequest {
return &DescribeSnapPolicesRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapPolicies:describe",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
}
}
/*
* param regionId: 地域ID (Required)
* param filterGroups: 过滤条件 (Optional)
* param order: 排序字段只支持create_time和update_time字段 (Optional)
* param pageNumber: 页码, 默认为1, 取值范围:[1,∞) (Optional)
* param pageSize: 分页大小默认为20取值范围[10,100] (Optional)
*/
func NewDescribeSnapPolicesRequestWithAllParams(
regionId string,
filterGroups []disk.FilterGroups,
order *disk.OrderItem,
pageNumber *int,
pageSize *int,
) *DescribeSnapPolicesRequest {
return &DescribeSnapPolicesRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapPolicies:describe",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
FilterGroups: filterGroups,
Order: order,
PageNumber: pageNumber,
PageSize: pageSize,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewDescribeSnapPolicesRequestWithoutParam() *DescribeSnapPolicesRequest {
return &DescribeSnapPolicesRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapPolicies:describe",
Method: "POST",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *DescribeSnapPolicesRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param filterGroups: 过滤条件(Optional) */
func (r *DescribeSnapPolicesRequest) SetFilterGroups(filterGroups []disk.FilterGroups) {
r.FilterGroups = filterGroups
}
/* param order: 排序字段只支持create_time和update_time字段(Optional) */
func (r *DescribeSnapPolicesRequest) SetOrder(order *disk.OrderItem) {
r.Order = order
}
/* param pageNumber: 页码, 默认为1, 取值范围:[1,∞)(Optional) */
func (r *DescribeSnapPolicesRequest) SetPageNumber(pageNumber int) {
r.PageNumber = &pageNumber
}
/* param pageSize: 分页大小默认为20取值范围[10,100](Optional) */
func (r *DescribeSnapPolicesRequest) SetPageSize(pageSize int) {
r.PageSize = &pageSize
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r DescribeSnapPolicesRequest) GetRegionId() string {
return r.RegionId
}
type DescribeSnapPolicesResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result DescribeSnapPolicesResult `json:"result"`
}
type DescribeSnapPolicesResult struct {
Policies []disk.SnapshotPolicy `json:"policies"`
TotalCount int `json:"totalCount"`
}

View File

@@ -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"
disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models"
)
type DescribeSnapshotRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 快照ID */
SnapshotId string `json:"snapshotId"`
}
/*
* param regionId: 地域ID (Required)
* param snapshotId: 快照ID (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewDescribeSnapshotRequest(
regionId string,
snapshotId string,
) *DescribeSnapshotRequest {
return &DescribeSnapshotRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots/{snapshotId}",
Method: "GET",
Header: nil,
Version: "v1",
},
RegionId: regionId,
SnapshotId: snapshotId,
}
}
/*
* param regionId: 地域ID (Required)
* param snapshotId: 快照ID (Required)
*/
func NewDescribeSnapshotRequestWithAllParams(
regionId string,
snapshotId string,
) *DescribeSnapshotRequest {
return &DescribeSnapshotRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots/{snapshotId}",
Method: "GET",
Header: nil,
Version: "v1",
},
RegionId: regionId,
SnapshotId: snapshotId,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewDescribeSnapshotRequestWithoutParam() *DescribeSnapshotRequest {
return &DescribeSnapshotRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots/{snapshotId}",
Method: "GET",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *DescribeSnapshotRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param snapshotId: 快照ID(Required) */
func (r *DescribeSnapshotRequest) SetSnapshotId(snapshotId string) {
r.SnapshotId = snapshotId
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r DescribeSnapshotRequest) GetRegionId() string {
return r.RegionId
}
type DescribeSnapshotResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result DescribeSnapshotResult `json:"result"`
}
type DescribeSnapshotResult struct {
Snapshot disk.Snapshot `json:"snapshot"`
}

View File

@@ -0,0 +1,123 @@
// 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 DescribeSnapshotChainRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 云硬盘ID (Optional) */
DiskId *string `json:"diskId"`
/* 快照ID (Optional) */
SnapshotId *string `json:"snapshotId"`
}
/*
* param regionId: 地域ID (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewDescribeSnapshotChainRequest(
regionId string,
) *DescribeSnapshotChainRequest {
return &DescribeSnapshotChainRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots:chain",
Method: "GET",
Header: nil,
Version: "v1",
},
RegionId: regionId,
}
}
/*
* param regionId: 地域ID (Required)
* param diskId: 云硬盘ID (Optional)
* param snapshotId: 快照ID (Optional)
*/
func NewDescribeSnapshotChainRequestWithAllParams(
regionId string,
diskId *string,
snapshotId *string,
) *DescribeSnapshotChainRequest {
return &DescribeSnapshotChainRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots:chain",
Method: "GET",
Header: nil,
Version: "v1",
},
RegionId: regionId,
DiskId: diskId,
SnapshotId: snapshotId,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewDescribeSnapshotChainRequestWithoutParam() *DescribeSnapshotChainRequest {
return &DescribeSnapshotChainRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots:chain",
Method: "GET",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *DescribeSnapshotChainRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param diskId: 云硬盘ID(Optional) */
func (r *DescribeSnapshotChainRequest) SetDiskId(diskId string) {
r.DiskId = &diskId
}
/* param snapshotId: 快照ID(Optional) */
func (r *DescribeSnapshotChainRequest) SetSnapshotId(snapshotId string) {
r.SnapshotId = &snapshotId
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r DescribeSnapshotChainRequest) GetRegionId() string {
return r.RegionId
}
type DescribeSnapshotChainResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result DescribeSnapshotChainResult `json:"result"`
}
type DescribeSnapshotChainResult struct {
SnapshotChain interface{} `json:"snapshotChain"`
}

View File

@@ -0,0 +1,169 @@
// 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"
disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models"
)
type DescribeSnapshotPoliciesRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 策略名称 (Optional) */
Name *string `json:"name"`
/* 策略ID (Optional) */
PolicyId []string `json:"policyId"`
/* 策略状态。1: 启用 2禁用 (Optional) */
Status []int `json:"status"`
/* 排序字段只支持create_time和update_time字段 (Optional) */
Order *disk.OrderItem `json:"order"`
/* 页码, 默认为1, 取值范围:[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 NewDescribeSnapshotPoliciesRequest(
regionId string,
) *DescribeSnapshotPoliciesRequest {
return &DescribeSnapshotPoliciesRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicies:describe",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
}
}
/*
* param regionId: 地域ID (Required)
* param name: 策略名称 (Optional)
* param policyId: 策略ID (Optional)
* param status: 策略状态。1: 启用 2禁用 (Optional)
* param order: 排序字段只支持create_time和update_time字段 (Optional)
* param pageNumber: 页码, 默认为1, 取值范围:[1,∞) (Optional)
* param pageSize: 分页大小默认为20取值范围[10,100] (Optional)
*/
func NewDescribeSnapshotPoliciesRequestWithAllParams(
regionId string,
name *string,
policyId []string,
status []int,
order *disk.OrderItem,
pageNumber *int,
pageSize *int,
) *DescribeSnapshotPoliciesRequest {
return &DescribeSnapshotPoliciesRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicies:describe",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
Name: name,
PolicyId: policyId,
Status: status,
Order: order,
PageNumber: pageNumber,
PageSize: pageSize,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewDescribeSnapshotPoliciesRequestWithoutParam() *DescribeSnapshotPoliciesRequest {
return &DescribeSnapshotPoliciesRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicies:describe",
Method: "POST",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *DescribeSnapshotPoliciesRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param name: 策略名称(Optional) */
func (r *DescribeSnapshotPoliciesRequest) SetName(name string) {
r.Name = &name
}
/* param policyId: 策略ID(Optional) */
func (r *DescribeSnapshotPoliciesRequest) SetPolicyId(policyId []string) {
r.PolicyId = policyId
}
/* param status: 策略状态。1: 启用 2禁用(Optional) */
func (r *DescribeSnapshotPoliciesRequest) SetStatus(status []int) {
r.Status = status
}
/* param order: 排序字段只支持create_time和update_time字段(Optional) */
func (r *DescribeSnapshotPoliciesRequest) SetOrder(order *disk.OrderItem) {
r.Order = order
}
/* param pageNumber: 页码, 默认为1, 取值范围:[1,∞)(Optional) */
func (r *DescribeSnapshotPoliciesRequest) SetPageNumber(pageNumber int) {
r.PageNumber = &pageNumber
}
/* param pageSize: 分页大小默认为20取值范围[10,100](Optional) */
func (r *DescribeSnapshotPoliciesRequest) SetPageSize(pageSize int) {
r.PageSize = &pageSize
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r DescribeSnapshotPoliciesRequest) GetRegionId() string {
return r.RegionId
}
type DescribeSnapshotPoliciesResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result DescribeSnapshotPoliciesResult `json:"result"`
}
type DescribeSnapshotPoliciesResult struct {
Policies []disk.SnapshotPolicy `json:"policies"`
TotalCount int `json:"totalCount"`
}

View File

@@ -0,0 +1,158 @@
// 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"
disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models"
)
type DescribeSnapshotPolicyDiskRelationsRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 磁盘ID (Optional) */
DiskId []string `json:"diskId"`
/* 磁盘地域ID (Optional) */
DiskRegion []string `json:"diskRegion"`
/* 策略ID (Optional) */
PolicyId []string `json:"policyId"`
/* 页码, 默认为1, 取值范围:[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 NewDescribeSnapshotPolicyDiskRelationsRequest(
regionId string,
) *DescribeSnapshotPolicyDiskRelationsRequest {
return &DescribeSnapshotPolicyDiskRelationsRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicyDiskRelations:describe",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
}
}
/*
* param regionId: 地域ID (Required)
* param diskId: 磁盘ID (Optional)
* param diskRegion: 磁盘地域ID (Optional)
* param policyId: 策略ID (Optional)
* param pageNumber: 页码, 默认为1, 取值范围:[1,∞) (Optional)
* param pageSize: 分页大小默认为20取值范围[10,100] (Optional)
*/
func NewDescribeSnapshotPolicyDiskRelationsRequestWithAllParams(
regionId string,
diskId []string,
diskRegion []string,
policyId []string,
pageNumber *int,
pageSize *int,
) *DescribeSnapshotPolicyDiskRelationsRequest {
return &DescribeSnapshotPolicyDiskRelationsRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicyDiskRelations:describe",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
DiskId: diskId,
DiskRegion: diskRegion,
PolicyId: policyId,
PageNumber: pageNumber,
PageSize: pageSize,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewDescribeSnapshotPolicyDiskRelationsRequestWithoutParam() *DescribeSnapshotPolicyDiskRelationsRequest {
return &DescribeSnapshotPolicyDiskRelationsRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicyDiskRelations:describe",
Method: "POST",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *DescribeSnapshotPolicyDiskRelationsRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param diskId: 磁盘ID(Optional) */
func (r *DescribeSnapshotPolicyDiskRelationsRequest) SetDiskId(diskId []string) {
r.DiskId = diskId
}
/* param diskRegion: 磁盘地域ID(Optional) */
func (r *DescribeSnapshotPolicyDiskRelationsRequest) SetDiskRegion(diskRegion []string) {
r.DiskRegion = diskRegion
}
/* param policyId: 策略ID(Optional) */
func (r *DescribeSnapshotPolicyDiskRelationsRequest) SetPolicyId(policyId []string) {
r.PolicyId = policyId
}
/* param pageNumber: 页码, 默认为1, 取值范围:[1,∞)(Optional) */
func (r *DescribeSnapshotPolicyDiskRelationsRequest) SetPageNumber(pageNumber int) {
r.PageNumber = &pageNumber
}
/* param pageSize: 分页大小默认为20取值范围[10,100](Optional) */
func (r *DescribeSnapshotPolicyDiskRelationsRequest) SetPageSize(pageSize int) {
r.PageSize = &pageSize
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r DescribeSnapshotPolicyDiskRelationsRequest) GetRegionId() string {
return r.RegionId
}
type DescribeSnapshotPolicyDiskRelationsResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result DescribeSnapshotPolicyDiskRelationsResult `json:"result"`
}
type DescribeSnapshotPolicyDiskRelationsResult struct {
TotalCount int `json:"totalCount"`
RelationResults []disk.DescSnapshotRelationsData `json:"relationResults"`
}

View File

@@ -0,0 +1,160 @@
// 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"
disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models"
common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models"
)
type DescribeSnapshotsRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 页码, 默认为1, 取值范围:[1,∞) (Optional) */
PageNumber *int `json:"pageNumber"`
/* 分页大小默认为20取值范围[10,100] (Optional) */
PageSize *int `json:"pageSize"`
/* 查找快照的类型可以为privateothersshared默认为private (Optional) */
SnapshotSource *string `json:"snapshotSource"`
/* snapshotId - 云硬盘快照ID支持多个
diskId - 生成快照的云硬盘ID支持多个
status - 快照状态,精确匹配,支持多个,取值为 creating、available、copying、deleting、error_create、error_delete
name - 快照名称,模糊匹配,支持单个
(Optional) */
Filters []common.Filter `json:"filters"`
}
/*
* param regionId: 地域ID (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewDescribeSnapshotsRequest(
regionId string,
) *DescribeSnapshotsRequest {
return &DescribeSnapshotsRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots",
Method: "GET",
Header: nil,
Version: "v1",
},
RegionId: regionId,
}
}
/*
* param regionId: 地域ID (Required)
* param pageNumber: 页码, 默认为1, 取值范围:[1,∞) (Optional)
* param pageSize: 分页大小默认为20取值范围[10,100] (Optional)
* param snapshotSource: 查找快照的类型可以为privateothersshared默认为private (Optional)
* param filters: snapshotId - 云硬盘快照ID支持多个
diskId - 生成快照的云硬盘ID支持多个
status - 快照状态,精确匹配,支持多个,取值为 creating、available、copying、deleting、error_create、error_delete
name - 快照名称,模糊匹配,支持单个
(Optional)
*/
func NewDescribeSnapshotsRequestWithAllParams(
regionId string,
pageNumber *int,
pageSize *int,
snapshotSource *string,
filters []common.Filter,
) *DescribeSnapshotsRequest {
return &DescribeSnapshotsRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots",
Method: "GET",
Header: nil,
Version: "v1",
},
RegionId: regionId,
PageNumber: pageNumber,
PageSize: pageSize,
SnapshotSource: snapshotSource,
Filters: filters,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewDescribeSnapshotsRequestWithoutParam() *DescribeSnapshotsRequest {
return &DescribeSnapshotsRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots",
Method: "GET",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *DescribeSnapshotsRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param pageNumber: 页码, 默认为1, 取值范围:[1,∞)(Optional) */
func (r *DescribeSnapshotsRequest) SetPageNumber(pageNumber int) {
r.PageNumber = &pageNumber
}
/* param pageSize: 分页大小默认为20取值范围[10,100](Optional) */
func (r *DescribeSnapshotsRequest) SetPageSize(pageSize int) {
r.PageSize = &pageSize
}
/* param snapshotSource: 查找快照的类型可以为privateothersshared默认为private(Optional) */
func (r *DescribeSnapshotsRequest) SetSnapshotSource(snapshotSource string) {
r.SnapshotSource = &snapshotSource
}
/* param filters: snapshotId - 云硬盘快照ID支持多个
diskId - 生成快照的云硬盘ID支持多个
status - 快照状态,精确匹配,支持多个,取值为 creating、available、copying、deleting、error_create、error_delete
name - 快照名称,模糊匹配,支持单个
(Optional) */
func (r *DescribeSnapshotsRequest) SetFilters(filters []common.Filter) {
r.Filters = filters
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r DescribeSnapshotsRequest) GetRegionId() string {
return r.RegionId
}
type DescribeSnapshotsResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result DescribeSnapshotsResult `json:"result"`
}
type DescribeSnapshotsResult struct {
Snapshots []disk.Snapshot `json:"snapshots"`
TotalCount int `json:"totalCount"`
}

View File

@@ -0,0 +1,102 @@
// 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"
disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models"
)
type DescribeSnapshotsCapacityRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
}
/*
* param regionId: 地域ID (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewDescribeSnapshotsCapacityRequest(
regionId string,
) *DescribeSnapshotsCapacityRequest {
return &DescribeSnapshotsCapacityRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots:capacity",
Method: "GET",
Header: nil,
Version: "v1",
},
RegionId: regionId,
}
}
/*
* param regionId: 地域ID (Required)
*/
func NewDescribeSnapshotsCapacityRequestWithAllParams(
regionId string,
) *DescribeSnapshotsCapacityRequest {
return &DescribeSnapshotsCapacityRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots:capacity",
Method: "GET",
Header: nil,
Version: "v1",
},
RegionId: regionId,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewDescribeSnapshotsCapacityRequestWithoutParam() *DescribeSnapshotsCapacityRequest {
return &DescribeSnapshotsCapacityRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots:capacity",
Method: "GET",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *DescribeSnapshotsCapacityRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r DescribeSnapshotsCapacityRequest) GetRegionId() string {
return r.RegionId
}
type DescribeSnapshotsCapacityResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result DescribeSnapshotsCapacityResult `json:"result"`
}
type DescribeSnapshotsCapacityResult struct {
Capacities []disk.SnapshotCapacity `json:"capacities"`
}

View File

@@ -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"
disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models"
)
type DescribeVolumesIgnoreServiceCodeRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 页码, 默认为1, 取值范围:[1,∞) (Optional) */
PageNumber *int `json:"pageNumber"`
/* 分页大小默认为20取值范围[10,100] (Optional) */
PageSize *int `json:"pageSize"`
/* Tag筛选条件 (Optional) */
Tags []disk.TagFilter `json:"tags"`
/* diskId - 云硬盘ID精确匹配支持多个
diskType - 云硬盘类型,精确匹配,支持多个,取值为 ssd,premium-hdd,ssd.io1,ssd.gp1,hdd.std1
instanceId - 云硬盘所挂载主机的ID精确匹配支持多个
instanceType - 云硬盘所挂载主机的类型,精确匹配,支持多个
status - 可用区,精确匹配,支持多个
az - 云硬盘状态,精确匹配,支持多个
name - 云硬盘名称,模糊匹配,支持单个
multiAttach - 云硬盘是否多点挂载,精确匹配,支持单个
encrypted - 云硬盘是否加密,精确匹配,支持单个
policyId - 绑定policyId的云硬盘精确匹配支持多个
notPolicyId - 未绑定policyId的云硬盘精确匹配支持多个
(Optional) */
FilterGroups []disk.FilterGroups `json:"filterGroups"`
}
/*
* param regionId: 地域ID (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewDescribeVolumesIgnoreServiceCodeRequest(
regionId string,
) *DescribeVolumesIgnoreServiceCodeRequest {
return &DescribeVolumesIgnoreServiceCodeRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks:ignoreServiceCode",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
}
}
/*
* param regionId: 地域ID (Required)
* param pageNumber: 页码, 默认为1, 取值范围:[1,∞) (Optional)
* param pageSize: 分页大小默认为20取值范围[10,100] (Optional)
* param tags: Tag筛选条件 (Optional)
* param filterGroups: diskId - 云硬盘ID精确匹配支持多个
diskType - 云硬盘类型,精确匹配,支持多个,取值为 ssd,premium-hdd,ssd.io1,ssd.gp1,hdd.std1
instanceId - 云硬盘所挂载主机的ID精确匹配支持多个
instanceType - 云硬盘所挂载主机的类型,精确匹配,支持多个
status - 可用区,精确匹配,支持多个
az - 云硬盘状态,精确匹配,支持多个
name - 云硬盘名称,模糊匹配,支持单个
multiAttach - 云硬盘是否多点挂载,精确匹配,支持单个
encrypted - 云硬盘是否加密,精确匹配,支持单个
policyId - 绑定policyId的云硬盘精确匹配支持多个
notPolicyId - 未绑定policyId的云硬盘精确匹配支持多个
(Optional)
*/
func NewDescribeVolumesIgnoreServiceCodeRequestWithAllParams(
regionId string,
pageNumber *int,
pageSize *int,
tags []disk.TagFilter,
filterGroups []disk.FilterGroups,
) *DescribeVolumesIgnoreServiceCodeRequest {
return &DescribeVolumesIgnoreServiceCodeRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks:ignoreServiceCode",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
PageNumber: pageNumber,
PageSize: pageSize,
Tags: tags,
FilterGroups: filterGroups,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewDescribeVolumesIgnoreServiceCodeRequestWithoutParam() *DescribeVolumesIgnoreServiceCodeRequest {
return &DescribeVolumesIgnoreServiceCodeRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks:ignoreServiceCode",
Method: "POST",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *DescribeVolumesIgnoreServiceCodeRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param pageNumber: 页码, 默认为1, 取值范围:[1,∞)(Optional) */
func (r *DescribeVolumesIgnoreServiceCodeRequest) SetPageNumber(pageNumber int) {
r.PageNumber = &pageNumber
}
/* param pageSize: 分页大小默认为20取值范围[10,100](Optional) */
func (r *DescribeVolumesIgnoreServiceCodeRequest) SetPageSize(pageSize int) {
r.PageSize = &pageSize
}
/* param tags: Tag筛选条件(Optional) */
func (r *DescribeVolumesIgnoreServiceCodeRequest) SetTags(tags []disk.TagFilter) {
r.Tags = tags
}
/* param filterGroups: diskId - 云硬盘ID精确匹配支持多个
diskType - 云硬盘类型,精确匹配,支持多个,取值为 ssd,premium-hdd,ssd.io1,ssd.gp1,hdd.std1
instanceId - 云硬盘所挂载主机的ID精确匹配支持多个
instanceType - 云硬盘所挂载主机的类型,精确匹配,支持多个
status - 可用区,精确匹配,支持多个
az - 云硬盘状态,精确匹配,支持多个
name - 云硬盘名称,模糊匹配,支持单个
multiAttach - 云硬盘是否多点挂载,精确匹配,支持单个
encrypted - 云硬盘是否加密,精确匹配,支持单个
policyId - 绑定policyId的云硬盘精确匹配支持多个
notPolicyId - 未绑定policyId的云硬盘精确匹配支持多个
(Optional) */
func (r *DescribeVolumesIgnoreServiceCodeRequest) SetFilterGroups(filterGroups []disk.FilterGroups) {
r.FilterGroups = filterGroups
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r DescribeVolumesIgnoreServiceCodeRequest) GetRegionId() string {
return r.RegionId
}
type DescribeVolumesIgnoreServiceCodeResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result DescribeVolumesIgnoreServiceCodeResult `json:"result"`
}
type DescribeVolumesIgnoreServiceCodeResult struct {
Disks []disk.Disk `json:"disks"`
TotalCount int `json:"totalCount"`
}

View File

@@ -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 ExtendDiskRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 云硬盘ID */
DiskId string `json:"diskId"`
/* 扩容后的云硬盘大小单位为GiB */
DiskSizeGB int `json:"diskSizeGB"`
/* 修改ssd.io1型云硬盘的iops数量当且仅当ssd.io1型的云盘类型有效步长是10. (Optional) */
Iops *int `json:"iops"`
}
/*
* param regionId: 地域ID (Required)
* param diskId: 云硬盘ID (Required)
* param diskSizeGB: 扩容后的云硬盘大小单位为GiB (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewExtendDiskRequest(
regionId string,
diskId string,
diskSizeGB int,
) *ExtendDiskRequest {
return &ExtendDiskRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks/{diskId}:extend",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
DiskId: diskId,
DiskSizeGB: diskSizeGB,
}
}
/*
* param regionId: 地域ID (Required)
* param diskId: 云硬盘ID (Required)
* param diskSizeGB: 扩容后的云硬盘大小单位为GiB (Required)
* param iops: 修改ssd.io1型云硬盘的iops数量当且仅当ssd.io1型的云盘类型有效步长是10. (Optional)
*/
func NewExtendDiskRequestWithAllParams(
regionId string,
diskId string,
diskSizeGB int,
iops *int,
) *ExtendDiskRequest {
return &ExtendDiskRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks/{diskId}:extend",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
DiskId: diskId,
DiskSizeGB: diskSizeGB,
Iops: iops,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewExtendDiskRequestWithoutParam() *ExtendDiskRequest {
return &ExtendDiskRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks/{diskId}:extend",
Method: "POST",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *ExtendDiskRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param diskId: 云硬盘ID(Required) */
func (r *ExtendDiskRequest) SetDiskId(diskId string) {
r.DiskId = diskId
}
/* param diskSizeGB: 扩容后的云硬盘大小单位为GiB(Required) */
func (r *ExtendDiskRequest) SetDiskSizeGB(diskSizeGB int) {
r.DiskSizeGB = diskSizeGB
}
/* param iops: 修改ssd.io1型云硬盘的iops数量当且仅当ssd.io1型的云盘类型有效步长是10.(Optional) */
func (r *ExtendDiskRequest) SetIops(iops int) {
r.Iops = &iops
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r ExtendDiskRequest) GetRegionId() string {
return r.RegionId
}
type ExtendDiskResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result ExtendDiskResult `json:"result"`
}
type ExtendDiskResult struct {
}

View File

@@ -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 ModifyDiskAttributeRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 云硬盘ID */
DiskId string `json:"diskId"`
/* 云硬盘名称只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”不允许为空且不超过32字符。 (Optional) */
Name *string `json:"name"`
/* 云硬盘描述允许输入UTF-8编码下的全部字符不超过256字符。 (Optional) */
Description *string `json:"description"`
}
/*
* param regionId: 地域ID (Required)
* param diskId: 云硬盘ID (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewModifyDiskAttributeRequest(
regionId string,
diskId string,
) *ModifyDiskAttributeRequest {
return &ModifyDiskAttributeRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks/{diskId}",
Method: "PATCH",
Header: nil,
Version: "v1",
},
RegionId: regionId,
DiskId: diskId,
}
}
/*
* param regionId: 地域ID (Required)
* param diskId: 云硬盘ID (Required)
* param name: 云硬盘名称只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”不允许为空且不超过32字符。 (Optional)
* param description: 云硬盘描述允许输入UTF-8编码下的全部字符不超过256字符。 (Optional)
*/
func NewModifyDiskAttributeRequestWithAllParams(
regionId string,
diskId string,
name *string,
description *string,
) *ModifyDiskAttributeRequest {
return &ModifyDiskAttributeRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks/{diskId}",
Method: "PATCH",
Header: nil,
Version: "v1",
},
RegionId: regionId,
DiskId: diskId,
Name: name,
Description: description,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewModifyDiskAttributeRequestWithoutParam() *ModifyDiskAttributeRequest {
return &ModifyDiskAttributeRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks/{diskId}",
Method: "PATCH",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *ModifyDiskAttributeRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param diskId: 云硬盘ID(Required) */
func (r *ModifyDiskAttributeRequest) SetDiskId(diskId string) {
r.DiskId = diskId
}
/* param name: 云硬盘名称只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”不允许为空且不超过32字符。(Optional) */
func (r *ModifyDiskAttributeRequest) SetName(name string) {
r.Name = &name
}
/* param description: 云硬盘描述允许输入UTF-8编码下的全部字符不超过256字符。(Optional) */
func (r *ModifyDiskAttributeRequest) SetDescription(description string) {
r.Description = &description
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r ModifyDiskAttributeRequest) GetRegionId() string {
return r.RegionId
}
type ModifyDiskAttributeResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result ModifyDiskAttributeResult `json:"result"`
}
type ModifyDiskAttributeResult struct {
}

View File

@@ -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 ModifySnapshotAttributeRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 快照ID */
SnapshotId string `json:"snapshotId"`
/* 快照名称 (Optional) */
Name *string `json:"name"`
/* 快照描述 (Optional) */
Description *string `json:"description"`
/* 快照过期时间,三者至少指定一个 (Optional) */
ExpireTime *string `json:"expireTime"`
}
/*
* param regionId: 地域ID (Required)
* param snapshotId: 快照ID (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewModifySnapshotAttributeRequest(
regionId string,
snapshotId string,
) *ModifySnapshotAttributeRequest {
return &ModifySnapshotAttributeRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots/{snapshotId}",
Method: "PATCH",
Header: nil,
Version: "v1",
},
RegionId: regionId,
SnapshotId: snapshotId,
}
}
/*
* param regionId: 地域ID (Required)
* param snapshotId: 快照ID (Required)
* param name: 快照名称 (Optional)
* param description: 快照描述 (Optional)
* param expireTime: 快照过期时间,三者至少指定一个 (Optional)
*/
func NewModifySnapshotAttributeRequestWithAllParams(
regionId string,
snapshotId string,
name *string,
description *string,
expireTime *string,
) *ModifySnapshotAttributeRequest {
return &ModifySnapshotAttributeRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots/{snapshotId}",
Method: "PATCH",
Header: nil,
Version: "v1",
},
RegionId: regionId,
SnapshotId: snapshotId,
Name: name,
Description: description,
ExpireTime: expireTime,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewModifySnapshotAttributeRequestWithoutParam() *ModifySnapshotAttributeRequest {
return &ModifySnapshotAttributeRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshots/{snapshotId}",
Method: "PATCH",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *ModifySnapshotAttributeRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param snapshotId: 快照ID(Required) */
func (r *ModifySnapshotAttributeRequest) SetSnapshotId(snapshotId string) {
r.SnapshotId = snapshotId
}
/* param name: 快照名称(Optional) */
func (r *ModifySnapshotAttributeRequest) SetName(name string) {
r.Name = &name
}
/* param description: 快照描述(Optional) */
func (r *ModifySnapshotAttributeRequest) SetDescription(description string) {
r.Description = &description
}
/* param expireTime: 快照过期时间,三者至少指定一个(Optional) */
func (r *ModifySnapshotAttributeRequest) SetExpireTime(expireTime string) {
r.ExpireTime = &expireTime
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r ModifySnapshotAttributeRequest) GetRegionId() string {
return r.RegionId
}
type ModifySnapshotAttributeResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result ModifySnapshotAttributeResult `json:"result"`
}
type ModifySnapshotAttributeResult struct {
}

View File

@@ -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 RestoreDiskRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 云硬盘ID */
DiskId string `json:"diskId"`
/* 用于恢复云盘的快照ID */
SnapshotId string `json:"snapshotId"`
}
/*
* param regionId: 地域ID (Required)
* param diskId: 云硬盘ID (Required)
* param snapshotId: 用于恢复云盘的快照ID (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewRestoreDiskRequest(
regionId string,
diskId string,
snapshotId string,
) *RestoreDiskRequest {
return &RestoreDiskRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks/{diskId}:restore",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
DiskId: diskId,
SnapshotId: snapshotId,
}
}
/*
* param regionId: 地域ID (Required)
* param diskId: 云硬盘ID (Required)
* param snapshotId: 用于恢复云盘的快照ID (Required)
*/
func NewRestoreDiskRequestWithAllParams(
regionId string,
diskId string,
snapshotId string,
) *RestoreDiskRequest {
return &RestoreDiskRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks/{diskId}:restore",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
DiskId: diskId,
SnapshotId: snapshotId,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewRestoreDiskRequestWithoutParam() *RestoreDiskRequest {
return &RestoreDiskRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/disks/{diskId}:restore",
Method: "POST",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *RestoreDiskRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param diskId: 云硬盘ID(Required) */
func (r *RestoreDiskRequest) SetDiskId(diskId string) {
r.DiskId = diskId
}
/* param snapshotId: 用于恢复云盘的快照ID(Required) */
func (r *RestoreDiskRequest) SetSnapshotId(snapshotId string) {
r.SnapshotId = snapshotId
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r RestoreDiskRequest) GetRegionId() string {
return r.RegionId
}
type RestoreDiskResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result RestoreDiskResult `json:"result"`
}
type RestoreDiskResult struct {
}

View File

@@ -0,0 +1,209 @@
// 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"
disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/models"
)
type UpdateSnapshotPolicyRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 策略ID */
PolicyId string `json:"policyId"`
/* 策略名称 */
Name string `json:"name"`
/* 策略执行周期,单位:秒不小于12小时 */
Interval int `json:"interval"`
/* 策略生效时间,格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00` */
EffectiveTime string `json:"effectiveTime"`
/* 快照保留时间,单位:秒0:表示不删除 */
SnapshotLifecycle int `json:"snapshotLifecycle"`
/* 联系人信息 (Optional) */
ContactInfo *disk.ContactInfo `json:"contactInfo"`
/* 策略状态。1:启用 2:禁用 */
Status int `json:"status"`
}
/*
* param regionId: 地域ID (Required)
* param policyId: 策略ID (Required)
* param name: 策略名称 (Required)
* param interval: 策略执行周期,单位:秒不小于12小时 (Required)
* param effectiveTime: 策略生效时间,格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00` (Required)
* param snapshotLifecycle: 快照保留时间,单位:秒0:表示不删除 (Required)
* param status: 策略状态。1:启用 2:禁用 (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewUpdateSnapshotPolicyRequest(
regionId string,
policyId string,
name string,
interval int,
effectiveTime string,
snapshotLifecycle int,
status int,
) *UpdateSnapshotPolicyRequest {
return &UpdateSnapshotPolicyRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicy/{policyId}",
Method: "PATCH",
Header: nil,
Version: "v1",
},
RegionId: regionId,
PolicyId: policyId,
Name: name,
Interval: interval,
EffectiveTime: effectiveTime,
SnapshotLifecycle: snapshotLifecycle,
Status: status,
}
}
/*
* param regionId: 地域ID (Required)
* param policyId: 策略ID (Required)
* param name: 策略名称 (Required)
* param interval: 策略执行周期,单位:秒不小于12小时 (Required)
* param effectiveTime: 策略生效时间,格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00` (Required)
* param snapshotLifecycle: 快照保留时间,单位:秒0:表示不删除 (Required)
* param contactInfo: 联系人信息 (Optional)
* param status: 策略状态。1:启用 2:禁用 (Required)
*/
func NewUpdateSnapshotPolicyRequestWithAllParams(
regionId string,
policyId string,
name string,
interval int,
effectiveTime string,
snapshotLifecycle int,
contactInfo *disk.ContactInfo,
status int,
) *UpdateSnapshotPolicyRequest {
return &UpdateSnapshotPolicyRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicy/{policyId}",
Method: "PATCH",
Header: nil,
Version: "v1",
},
RegionId: regionId,
PolicyId: policyId,
Name: name,
Interval: interval,
EffectiveTime: effectiveTime,
SnapshotLifecycle: snapshotLifecycle,
ContactInfo: contactInfo,
Status: status,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewUpdateSnapshotPolicyRequestWithoutParam() *UpdateSnapshotPolicyRequest {
return &UpdateSnapshotPolicyRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/snapshotPolicy/{policyId}",
Method: "PATCH",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *UpdateSnapshotPolicyRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param policyId: 策略ID(Required) */
func (r *UpdateSnapshotPolicyRequest) SetPolicyId(policyId string) {
r.PolicyId = policyId
}
/* param name: 策略名称(Required) */
func (r *UpdateSnapshotPolicyRequest) SetName(name string) {
r.Name = name
}
/* param interval: 策略执行周期,单位:秒不小于12小时(Required) */
func (r *UpdateSnapshotPolicyRequest) SetInterval(interval int) {
r.Interval = interval
}
/* param effectiveTime: 策略生效时间,格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00`(Required) */
func (r *UpdateSnapshotPolicyRequest) SetEffectiveTime(effectiveTime string) {
r.EffectiveTime = effectiveTime
}
/* param snapshotLifecycle: 快照保留时间,单位:秒0:表示不删除(Required) */
func (r *UpdateSnapshotPolicyRequest) SetSnapshotLifecycle(snapshotLifecycle int) {
r.SnapshotLifecycle = snapshotLifecycle
}
/* param contactInfo: 联系人信息(Optional) */
func (r *UpdateSnapshotPolicyRequest) SetContactInfo(contactInfo *disk.ContactInfo) {
r.ContactInfo = contactInfo
}
/* param status: 策略状态。1:启用 2:禁用(Required) */
func (r *UpdateSnapshotPolicyRequest) SetStatus(status int) {
r.Status = status
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r UpdateSnapshotPolicyRequest) GetRegionId() string {
return r.RegionId
}
type UpdateSnapshotPolicyResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result UpdateSnapshotPolicyResult `json:"result"`
}
type UpdateSnapshotPolicyResult struct {
Id string `json:"id"`
Name string `json:"name"`
Pin string `json:"pin"`
Interval int `json:"interval"`
EffectiveTime string `json:"effectiveTime"`
LastTriggerTime string `json:"lastTriggerTime"`
NextTriggerTime string `json:"nextTriggerTime"`
SnapshotLifecycle int `json:"snapshotLifecycle"`
ContactInfo disk.ContactInfo `json:"contactInfo"`
CreateTime string `json:"createTime"`
UpdateTime string `json:"updateTime"`
Status int `json:"status"`
DiskCount int `json:"diskCount"`
}

View File

@@ -0,0 +1,571 @@
// 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"
disk "github.com/jdcloud-api/jdcloud-sdk-go/services/disk/apis"
"encoding/json"
"errors"
)
type DiskClient struct {
core.JDCloudClient
}
func NewDiskClient(credential *core.Credential) *DiskClient {
if credential == nil {
return nil
}
config := core.NewConfig()
config.SetEndpoint("disk.jdcloud-api.com")
return &DiskClient{
core.JDCloudClient{
Credential: *credential,
Config: *config,
ServiceName: "disk",
Revision: "0.12.6",
Logger: core.NewDefaultLogger(core.LogInfo),
}}
}
func (c *DiskClient) SetConfig(config *core.Config) {
c.Config = *config
}
func (c *DiskClient) SetLogger(logger core.Logger) {
c.Logger = logger
}
func (c *DiskClient) DisableLogger() {
c.Logger = core.NewDummyLogger()
}
/* 查询快照策略 */
func (c *DiskClient) DescribeSnapPolices(request *disk.DescribeSnapPolicesRequest) (*disk.DescribeSnapPolicesResponse, 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 := &disk.DescribeSnapPolicesResponse{}
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 *DiskClient) ModifySnapshotAttribute(request *disk.ModifySnapshotAttributeRequest) (*disk.ModifySnapshotAttributeResponse, 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 := &disk.ModifySnapshotAttributeResponse{}
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
}
/* - 删除云硬盘快照:快照状态必须为 available 或 error 状态。
- 快照独立于云硬盘生命周期,删除快照不会对创建快照的云硬盘有任何影响。
- 快照删除后不可恢复,请谨慎操作。
*/
func (c *DiskClient) DeleteSnapshots(request *disk.DeleteSnapshotsRequest) (*disk.DeleteSnapshotsResponse, 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 := &disk.DeleteSnapshotsResponse{}
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 *DiskClient) UpdateSnapshotPolicy(request *disk.UpdateSnapshotPolicyRequest) (*disk.UpdateSnapshotPolicyResponse, 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 := &disk.UpdateSnapshotPolicyResponse{}
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 *DiskClient) DescribeSnapshotChain(request *disk.DescribeSnapshotChainRequest) (*disk.DescribeSnapshotChainResponse, 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 := &disk.DescribeSnapshotChainResponse{}
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 *DiskClient) DescribeSnapshotPolicyDiskRelations(request *disk.DescribeSnapshotPolicyDiskRelationsRequest) (*disk.DescribeSnapshotPolicyDiskRelationsResponse, 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 := &disk.DescribeSnapshotPolicyDiskRelationsResponse{}
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 *DiskClient) DeleteSnapshotPolicy(request *disk.DeleteSnapshotPolicyRequest) (*disk.DeleteSnapshotPolicyResponse, 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 := &disk.DeleteSnapshotPolicyResponse{}
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 *DiskClient) DescribeDisk(request *disk.DescribeDiskRequest) (*disk.DescribeDiskResponse, 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 := &disk.DescribeDiskResponse{}
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
}
/* - 扩容云硬盘到指定大小,云硬盘状态必须为 available。
- 当云硬盘正在创建快照时,不允许扩容。
*/
func (c *DiskClient) ExtendDisk(request *disk.ExtendDiskRequest) (*disk.ExtendDiskResponse, 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 := &disk.ExtendDiskResponse{}
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
}
/* - 查询您已经创建的云硬盘。
- filters多个过滤条件之间是逻辑与(AND),每个条件内部的多个取值是逻辑或(OR)
*/
func (c *DiskClient) DescribeVolumesIgnoreServiceCode(request *disk.DescribeVolumesIgnoreServiceCodeRequest) (*disk.DescribeVolumesIgnoreServiceCodeResponse, 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 := &disk.DescribeVolumesIgnoreServiceCodeResponse{}
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 *DiskClient) ModifyDiskAttribute(request *disk.ModifyDiskAttributeRequest) (*disk.ModifyDiskAttributeResponse, 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 := &disk.ModifyDiskAttributeResponse{}
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 *DiskClient) ApplySnapshotPolicies(request *disk.ApplySnapshotPoliciesRequest) (*disk.ApplySnapshotPoliciesResponse, 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 := &disk.ApplySnapshotPoliciesResponse{}
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 *DiskClient) DescribeSnapshotsCapacity(request *disk.DescribeSnapshotsCapacityRequest) (*disk.DescribeSnapshotsCapacityResponse, 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 := &disk.DescribeSnapshotsCapacityResponse{}
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
}
/* - 创建一块或多块按配置或者按使用时长付费的云硬盘。
- 云硬盘类型包括高效云盘(premium-hdd)、SSD云盘(ssd)、通用型SSD(ssd.gp1)、性能型SSD(ssd.io1)、容量型HDD(hdd.std1)。
- 计费方式默认为按配置付费。
- 创建完成后,云硬盘状态为 available。
- 可选参数快照 ID用于从快照创建新盘。
- 批量创建时,云硬盘的命名为 硬盘名称-数字,例如 myDisk-1myDisk-2。
- maxCount为最大努力不保证一定能达到maxCount。
- userTags 为创建云盘时打的标签
*/
func (c *DiskClient) CreateDisks(request *disk.CreateDisksRequest) (*disk.CreateDisksResponse, 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 := &disk.CreateDisksResponse{}
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
}
/* - 删除单个云硬盘快照:快照状态必须为 available 或 error 状态。
- 快照独立于云硬盘生命周期,删除快照不会对创建快照的云硬盘有任何影响。
- 快照删除后不可恢复,请谨慎操作。
*/
func (c *DiskClient) DeleteSnapshot(request *disk.DeleteSnapshotRequest) (*disk.DeleteSnapshotResponse, 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 := &disk.DeleteSnapshotResponse{}
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
}
/* 查询云硬盘快照列表filters多个过滤条件之间是逻辑与(AND),每个条件内部的多个取值是逻辑或(OR) */
func (c *DiskClient) DescribeSnapshots(request *disk.DescribeSnapshotsRequest) (*disk.DescribeSnapshotsResponse, 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 := &disk.DescribeSnapshotsResponse{}
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 *DiskClient) RestoreDisk(request *disk.RestoreDiskRequest) (*disk.RestoreDiskResponse, 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 := &disk.RestoreDiskResponse{}
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 *DiskClient) CreateSnapshotPolicy(request *disk.CreateSnapshotPolicyRequest) (*disk.CreateSnapshotPolicyResponse, 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 := &disk.CreateSnapshotPolicyResponse{}
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 *DiskClient) DescribeSnapshotPolicies(request *disk.DescribeSnapshotPoliciesRequest) (*disk.DescribeSnapshotPoliciesResponse, 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 := &disk.DescribeSnapshotPoliciesResponse{}
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
}
/* - 查询您已经创建的云硬盘。
- filters多个过滤条件之间是逻辑与(AND),每个条件内部的多个取值是逻辑或(OR)
*/
func (c *DiskClient) DescribeDisks(request *disk.DescribeDisksRequest) (*disk.DescribeDisksResponse, 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 := &disk.DescribeDisksResponse{}
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
}
/* - 删除一块按配置计费的云硬盘云盘类型包括高效云盘、SSD云盘、通用型SSD、性能型SSD和容量型HDD。
- 删除云盘时,云盘的状态必须为 待挂载Available
- 云盘被删除后,云硬盘快照可以被保留。
*/
func (c *DiskClient) DeleteDisk(request *disk.DeleteDiskRequest) (*disk.DeleteDiskResponse, 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 := &disk.DeleteDiskResponse{}
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
}
/* - 为指定云硬盘创建快照新生成的快照的状态为creating。
- 同一地域下单用户快照的配额为15块。
- 为保证数据完整性,请您在创建快照之前,停止对云硬盘进行写入操作,以保证快照数据的完整性。
- 在执行创建快照前,建议您对云硬盘进行卸载操作,创建快照后再重新挂载到云主机上。
- 手动快照的生命周期独立于云硬盘,请您及时删除不需要的快照。
- 创建快照所需时间取决于云硬盘容量的大小,云硬盘容量越大耗时越长。
*/
func (c *DiskClient) CreateSnapshot(request *disk.CreateSnapshotRequest) (*disk.CreateSnapshotResponse, 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 := &disk.CreateSnapshotResponse{}
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 *DiskClient) DescribeSnapshot(request *disk.DescribeSnapshotRequest) (*disk.DescribeSnapshotResponse, 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 := &disk.DescribeSnapshotResponse{}
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 *DiskClient) DescribeQuota(request *disk.DescribeQuotaRequest) (*disk.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 := &disk.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
}

View File

@@ -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 Bind struct {
/* 云硬盘绑定的InstanceUuid (Optional) */
ResourceId string `json:"resourceId"`
}

View File

@@ -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 ContactInfo struct {
/* 是否发送短信。0:不发送 1:发送 (Optional) */
Sms *int `json:"sms"`
/* 是否发送短信。0:不发送 1:发送 (Optional) */
Email *int `json:"email"`
/* 联系人id (Optional) */
PersonIds []int `json:"personIds"`
/* 联系组id (Optional) */
GroupIds []int `json:"groupIds"`
}

View File

@@ -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 Data struct {
/* 云硬盘ID (Optional) */
ResourceId string `json:"resourceId"`
/* 云硬盘名称只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”不允许为空且不超过32字符。 (Optional) */
ResourceName string `json:"resourceName"`
/* 云硬盘状态,取值为 creating、available、in-use、extending、restoring、deleting、deleted、error_create、error_delete、error_restore、error_extend 之一 (Optional) */
Status string `json:"status"`
/* 绑定资源列表 (Optional) */
Bind []Bind `json:"bind"`
}

View File

@@ -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 DelSnapshot struct {
/* 云硬盘快照ID (Optional) */
SnapshotId string `json:"snapshotId"`
/* 是否成功 (Optional) */
Success bool `json:"success"`
/* 详细信息 (Optional) */
Detail string `json:"detail"`
}

View File

@@ -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 DescSnapshotRelationsData struct {
/* 云硬盘ID (Optional) */
DiskId string `json:"diskId"`
/* 云硬盘地域ID (Optional) */
DiskRegion string `json:"diskRegion"`
/* 快照策略ID (Optional) */
PolicyId string `json:"policyId"`
/* 绑定时间。格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00` (Optional) */
CreateTime string `json:"createTime"`
}

View File

@@ -0,0 +1,76 @@
// 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) */
Enabled bool `json:"enabled"`
/* 创建云硬盘时间 (Optional) */
CreateTime string `json:"createTime"`
/* 云硬盘计费配置信息 (Optional) */
Charge charge.Charge `json:"charge"`
/* null (Optional) */
Tags []Tag `json:"tags"`
/* (Optional) */
SnapshotPolicies []SnapshotPolicy `json:"snapshotPolicies"`
}

View File

@@ -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"`
}

View File

@@ -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 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"`
/* 云硬盘大小,单位为 GiBssd 类型取值范围[20,1000]GB步长为10Gpremium-hdd 类型取值范围[20,3000]GB步长为10G, ssd.gp1, ssd.io1, hdd.std1 类型取值均是范围[20,16000]GB步长为10G */
DiskSizeGB int `json:"diskSizeGB"`
/* 云硬盘IOPS的大小当且仅当云盘类型是ssd.io1型的云盘有效步长是10. (Optional) */
Iops *int `json:"iops"`
/* 用于创建云硬盘的快照ID (Optional) */
SnapshotId *string `json:"snapshotId"`
/* 策略ID (Optional) */
PolicyId *string `json:"policyId"`
/* 计费配置;如不指定,默认计费类型是后付费-按使用时常付费 (Optional) */
Charge *charge.ChargeSpec `json:"charge"`
/* 云硬盘是否支持一盘多主机挂载默认为false不支持 (Optional) */
MultiAttachable *bool `json:"multiAttachable"`
/* 云硬盘是否加密默认为false不加密 (Optional) */
Encrypt *bool `json:"encrypt"`
}

View File

@@ -0,0 +1,63 @@
// 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"`
/* 类型名称 (Optional) */
DiskTypeName string `json:"diskTypeName"`
/* 默认的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"`
/* 是否开启IOPS可调整 (Optional) */
ScalableIOPS bool `json:"scalableIOPS"`
/* 最大iops步长 (Optional) */
MaxStepIOPS int `json:"maxStepIOPS"`
}

View File

@@ -0,0 +1,25 @@
// 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 common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models"
type FilterGroups struct {
/* (Optional) */
Filters []common.Filter `json:"filters"`
}

View File

@@ -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 OrderItem struct {
/* 排序字段。 (Optional) */
Name *string `json:"name"`
/* 0:升序 1:降序,必填 (Optional) */
Direction *int `json:"direction"`
}

View File

@@ -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 PolicyDiskRelationOp struct {
/* 磁盘ID */
DiskId string `json:"diskId"`
/* 磁盘地域ID */
DiskRegion string `json:"diskRegion"`
/* 快照策略ID */
PolicyId string `json:"policyId"`
/* 联系组id */
Op int `json:"op"`
}

View File

@@ -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 PolicyDiskRelationOpResult struct {
/* 状态码 (Optional) */
Code int `json:"code"`
/* 失败信息 (Optional) */
Message string `json:"message"`
/* 磁盘ID (Optional) */
DiskId string `json:"diskId"`
/* 磁盘地域ID (Optional) */
DiskRegion string `json:"diskRegion"`
/* 快照策略ID (Optional) */
PolicyId string `json:"policyId"`
/* 联系组id (Optional) */
Op int `json:"op"`
}

View File

@@ -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 PolicyDiskRelationOps struct {
/* (Optional) */
Items []PolicyDiskRelationOp `json:"items"`
}

View File

@@ -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"`
}

View File

@@ -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"`
}

View File

@@ -0,0 +1,60 @@
// 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"`
/* 快照来源 可以有selfothers两种来源 (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) */
ExpireTime string `json:"expireTime"`
/* 共享信息(已废弃使用shareInfo) (Optional) */
SharInfo []ShareInfo `json:"sharInfo"`
/* 共享信息 (Optional) */
ShareInfo []ShareInfo `json:"shareInfo"`
/* 快照是否为加密盘的快照 (Optional) */
Encrypted bool `json:"encrypted"`
}

View File

@@ -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 SnapshotCapacity struct {
/* 区域ID (Optional) */
Region string `json:"region"`
/* 快照个数 (Optional) */
SnapshotCount int `json:"snapshotCount"`
/* 快照总大小单位MB (Optional) */
TotalSize int `json:"totalSize"`
}

View File

@@ -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 SnapshotChain struct {
/* 快照链ID (Optional) */
DiskId string `json:"diskId"`
/* 快照链快照个数 (Optional) */
SnapshotTotalCount int `json:"snapshotTotalCount"`
/* 快照链快照总容量单位Byte (Optional) */
SnapshotChainSize int `json:"snapshotChainSize"`
}

View File

@@ -0,0 +1,60 @@
// 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 SnapshotPolicy struct {
/* 策略id (Optional) */
Id string `json:"id"`
/* 策略名称 (Optional) */
Name string `json:"name"`
/* 用户pin (Optional) */
Pin string `json:"pin"`
/* 策略执行间隔,单位:秒 (Optional) */
Interval int `json:"interval"`
/* 策略生效时间。格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00` (Optional) */
EffectiveTime string `json:"effectiveTime"`
/* 策略上次执行时间。格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00` (Optional) */
LastTriggerTime string `json:"lastTriggerTime"`
/* 策略下次执行时间。格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00` (Optional) */
NextTriggerTime string `json:"nextTriggerTime"`
/* 快照保留时间。单位:秒。0永久保留 (Optional) */
SnapshotLifecycle int `json:"snapshotLifecycle"`
/* 联系人信息 (Optional) */
ContactInfo ContactInfo `json:"contactInfo"`
/* 策略下次执行时间。格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00` (Optional) */
CreateTime string `json:"createTime"`
/* 策略下次执行时间。格式`YYYY-MM-DDTHH:mm:ss+xx:xx`。如`2020-02-02T20:02:00+08:00` (Optional) */
UpdateTime string `json:"updateTime"`
/* 策略状态。1启用 2禁用 (Optional) */
Status int `json:"status"`
/* 策略绑定的disk数量 (Optional) */
DiskCount int `json:"diskCount"`
}

View File

@@ -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"`
}

View File

@@ -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"`
}

View File

@@ -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"`
}

View File

@@ -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"`
}

View File

@@ -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 {
}

View File

@@ -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,vmj,vdk,vdl,vdm]挂载系统盘时必传且需传vda (Optional) */
DeviceName *string `json:"deviceName"`
/* 随云主机删除自动删除此云硬盘默认为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,vmj,vdk,vdl,vdm]挂载系统盘时必传且需传vda (Optional)
* param autoDelete: 随云主机删除自动删除此云硬盘默认为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,vmj,vdk,vdl,vdm]挂载系统盘时必传且需传vda(Optional) */
func (r *AttachDiskRequest) SetDeviceName(deviceName string) {
r.DeviceName = &deviceName
}
/* param autoDelete: 随云主机删除自动删除此云硬盘默认为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 {
}

View File

@@ -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"
)
type AttachKeypairRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 密钥名称 */
KeyName string `json:"keyName"`
/* 虚机Id */
InstanceIds []string `json:"instanceIds"`
/* 密码授权,绑定密钥后,根据此参数决定是否使用密码登录,"yes"为使用,"no"为不使用
*/
PassWordAuth string `json:"passWordAuth"`
}
/*
* param regionId: 地域ID (Required)
* param keyName: 密钥名称 (Required)
* param instanceIds: 虚机Id (Required)
* param passWordAuth: 密码授权,绑定密钥后,根据此参数决定是否使用密码登录,"yes"为使用,"no"为不使用
(Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewAttachKeypairRequest(
regionId string,
keyName string,
instanceIds []string,
passWordAuth string,
) *AttachKeypairRequest {
return &AttachKeypairRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/keypairs/{keyName}:attach",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
KeyName: keyName,
InstanceIds: instanceIds,
PassWordAuth: passWordAuth,
}
}
/*
* param regionId: 地域ID (Required)
* param keyName: 密钥名称 (Required)
* param instanceIds: 虚机Id (Required)
* param passWordAuth: 密码授权,绑定密钥后,根据此参数决定是否使用密码登录,"yes"为使用,"no"为不使用
(Required)
*/
func NewAttachKeypairRequestWithAllParams(
regionId string,
keyName string,
instanceIds []string,
passWordAuth string,
) *AttachKeypairRequest {
return &AttachKeypairRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/keypairs/{keyName}:attach",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
KeyName: keyName,
InstanceIds: instanceIds,
PassWordAuth: passWordAuth,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewAttachKeypairRequestWithoutParam() *AttachKeypairRequest {
return &AttachKeypairRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/keypairs/{keyName}:attach",
Method: "POST",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *AttachKeypairRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param keyName: 密钥名称(Required) */
func (r *AttachKeypairRequest) SetKeyName(keyName string) {
r.KeyName = keyName
}
/* param instanceIds: 虚机Id(Required) */
func (r *AttachKeypairRequest) SetInstanceIds(instanceIds []string) {
r.InstanceIds = instanceIds
}
/* param passWordAuth: 密码授权,绑定密钥后,根据此参数决定是否使用密码登录,"yes"为使用,"no"为不使用
(Required) */
func (r *AttachKeypairRequest) SetPassWordAuth(passWordAuth string) {
r.PassWordAuth = passWordAuth
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r AttachKeypairRequest) GetRegionId() string {
return r.RegionId
}
type AttachKeypairResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result AttachKeypairResult `json:"result"`
}
type AttachKeypairResult struct {
SuccessInstanceId []string `json:"successInstanceId"`
FailInstanceId []string `json:"failInstanceId"`
}

View File

@@ -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 {
}

View File

@@ -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"`
}

View File

@@ -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"
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"`
/* 镜像名称,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。 */
Name string `json:"name"`
/* 镜像描述,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。 (Optional) */
Description *string `json:"description"`
/* 数据盘列表,可以在实例已挂载数据盘的基础上,额外增加新的快照、空盘、或排除云主机中的数据盘。 (Optional) */
DataDisks []vm.InstanceDiskAttachmentSpec `json:"dataDisks"`
}
/*
* param regionId: 地域ID (Required)
* param instanceId: 云主机ID (Required)
* param name: 镜像名称,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。 (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewCreateImageRequest(
regionId string,
instanceId string,
name 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,
}
}
/*
* param regionId: 地域ID (Required)
* param instanceId: 云主机ID (Required)
* param name: 镜像名称,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。 (Required)
* param description: 镜像描述,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。 (Optional)
* 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: 镜像名称,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。(Required) */
func (r *CreateImageRequest) SetName(name string) {
r.Name = name
}
/* param description: 镜像描述,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。(Optional) */
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"`
}

View File

@@ -0,0 +1,141 @@
// 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 CreateInstanceTemplateRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 启动模板的数据 */
InstanceTemplateData *vm.InstanceTemplateSpec `json:"instanceTemplateData"`
/* 启动模板的名称,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。 */
Name string `json:"name"`
/* 启动模板的描述,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。 (Optional) */
Description *string `json:"description"`
}
/*
* param regionId: 地域ID (Required)
* param instanceTemplateData: 启动模板的数据 (Required)
* param name: 启动模板的名称,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。 (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewCreateInstanceTemplateRequest(
regionId string,
instanceTemplateData *vm.InstanceTemplateSpec,
name string,
) *CreateInstanceTemplateRequest {
return &CreateInstanceTemplateRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/instanceTemplates",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
InstanceTemplateData: instanceTemplateData,
Name: name,
}
}
/*
* param regionId: 地域ID (Required)
* param instanceTemplateData: 启动模板的数据 (Required)
* param name: 启动模板的名称,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。 (Required)
* param description: 启动模板的描述,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。 (Optional)
*/
func NewCreateInstanceTemplateRequestWithAllParams(
regionId string,
instanceTemplateData *vm.InstanceTemplateSpec,
name string,
description *string,
) *CreateInstanceTemplateRequest {
return &CreateInstanceTemplateRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/instanceTemplates",
Method: "POST",
Header: nil,
Version: "v1",
},
RegionId: regionId,
InstanceTemplateData: instanceTemplateData,
Name: name,
Description: description,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewCreateInstanceTemplateRequestWithoutParam() *CreateInstanceTemplateRequest {
return &CreateInstanceTemplateRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/instanceTemplates",
Method: "POST",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *CreateInstanceTemplateRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param instanceTemplateData: 启动模板的数据(Required) */
func (r *CreateInstanceTemplateRequest) SetInstanceTemplateData(instanceTemplateData *vm.InstanceTemplateSpec) {
r.InstanceTemplateData = instanceTemplateData
}
/* param name: 启动模板的名称,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。(Required) */
func (r *CreateInstanceTemplateRequest) SetName(name string) {
r.Name = name
}
/* param description: 启动模板的描述,<a href="http://docs.jdcloud.com/virtual-machines/api/general_parameters">参考公共参数规范</a>。(Optional) */
func (r *CreateInstanceTemplateRequest) SetDescription(description string) {
r.Description = &description
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r CreateInstanceTemplateRequest) GetRegionId() string {
return r.RegionId
}
type CreateInstanceTemplateResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result CreateInstanceTemplateResult `json:"result"`
}
type CreateInstanceTemplateResult struct {
InstanceTemplateId string `json:"instanceTemplateId"`
}

View File

@@ -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"`
}

View File

@@ -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"`
}

View File

@@ -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 DeleteImageRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 镜像ID */
ImageId string `json:"imageId"`
/* 删除镜像是否删除关联的快照默认为false如果指定为true, 将会删除镜像关联的快照。 (Optional) */
DeleteSnapshot *bool `json:"deleteSnapshot"`
}
/*
* 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)
* param deleteSnapshot: 删除镜像是否删除关联的快照默认为false如果指定为true, 将会删除镜像关联的快照。 (Optional)
*/
func NewDeleteImageRequestWithAllParams(
regionId string,
imageId string,
deleteSnapshot *bool,
) *DeleteImageRequest {
return &DeleteImageRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/images/{imageId}",
Method: "DELETE",
Header: nil,
Version: "v1",
},
RegionId: regionId,
ImageId: imageId,
DeleteSnapshot: deleteSnapshot,
}
}
/* 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
}
/* param deleteSnapshot: 删除镜像是否删除关联的快照默认为false如果指定为true, 将会删除镜像关联的快照。(Optional) */
func (r *DeleteImageRequest) SetDeleteSnapshot(deleteSnapshot bool) {
r.DeleteSnapshot = &deleteSnapshot
}
// 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 {
}

View File

@@ -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 {
}

View File

@@ -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 DeleteInstanceTemplateRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 启动模板ID */
InstanceTemplateId string `json:"instanceTemplateId"`
}
/*
* param regionId: 地域ID (Required)
* param instanceTemplateId: 启动模板ID (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewDeleteInstanceTemplateRequest(
regionId string,
instanceTemplateId string,
) *DeleteInstanceTemplateRequest {
return &DeleteInstanceTemplateRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/instanceTemplates/{instanceTemplateId}",
Method: "DELETE",
Header: nil,
Version: "v1",
},
RegionId: regionId,
InstanceTemplateId: instanceTemplateId,
}
}
/*
* param regionId: 地域ID (Required)
* param instanceTemplateId: 启动模板ID (Required)
*/
func NewDeleteInstanceTemplateRequestWithAllParams(
regionId string,
instanceTemplateId string,
) *DeleteInstanceTemplateRequest {
return &DeleteInstanceTemplateRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/instanceTemplates/{instanceTemplateId}",
Method: "DELETE",
Header: nil,
Version: "v1",
},
RegionId: regionId,
InstanceTemplateId: instanceTemplateId,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewDeleteInstanceTemplateRequestWithoutParam() *DeleteInstanceTemplateRequest {
return &DeleteInstanceTemplateRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/instanceTemplates/{instanceTemplateId}",
Method: "DELETE",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *DeleteInstanceTemplateRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param instanceTemplateId: 启动模板ID(Required) */
func (r *DeleteInstanceTemplateRequest) SetInstanceTemplateId(instanceTemplateId string) {
r.InstanceTemplateId = instanceTemplateId
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r DeleteInstanceTemplateRequest) GetRegionId() string {
return r.RegionId
}
type DeleteInstanceTemplateResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result DeleteInstanceTemplateResult `json:"result"`
}
type DeleteInstanceTemplateResult struct {
}

View File

@@ -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 {
}

View File

@@ -0,0 +1,193 @@
// 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 DescribeBriefInstancesRequest struct {
core.JDCloudRequest
/* 地域ID */
RegionId string `json:"regionId"`
/* 页码默认为1 (Optional) */
PageNumber *int `json:"pageNumber"`
/* 分页大小默认为20取值范围[10, 100] (Optional) */
PageSize *int `json:"pageSize"`
/* Tag筛选条件 (Optional) */
Tags []vm.TagFilter `json:"tags"`
/* instanceId - 云主机ID精确匹配支持多个
privateIpAddress - 主网卡内网主IP地址模糊匹配支持多个
az - 可用区,精确匹配,支持多个
vpcId - 私有网络ID精确匹配支持多个
status - 云主机状态,精确匹配,支持多个,<a href="http://docs.jdcloud.com/virtual-machines/api/vm_status">参考云主机状态</a>
name - 云主机名称,模糊匹配,支持单个
imageId - 镜像ID精确匹配支持多个
networkInterfaceId - 弹性网卡ID精确匹配支持多个
subnetId - 子网ID精确匹配支持多个
agId - 使用可用组id支持单个
faultDomain - 错误域,支持多个
dedicatedHostId - 专有宿主机ID精确匹配支持多个
dedicatedPoolId - 专有宿主机池ID精确匹配支持多个
instanceType - 实例规格,精确匹配,支持多个
elasticIpAddress - 公网IP地址精确匹配支持单个
(Optional) */
Filters []common.Filter `json:"filters"`
}
/*
* param regionId: 地域ID (Required)
*
* @Deprecated, not compatible when mandatory parameters changed
*/
func NewDescribeBriefInstancesRequest(
regionId string,
) *DescribeBriefInstancesRequest {
return &DescribeBriefInstancesRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/instances:describeBriefInstances",
Method: "GET",
Header: nil,
Version: "v1",
},
RegionId: regionId,
}
}
/*
* param regionId: 地域ID (Required)
* param pageNumber: 页码默认为1 (Optional)
* param pageSize: 分页大小默认为20取值范围[10, 100] (Optional)
* param tags: Tag筛选条件 (Optional)
* param filters: instanceId - 云主机ID精确匹配支持多个
privateIpAddress - 主网卡内网主IP地址模糊匹配支持多个
az - 可用区,精确匹配,支持多个
vpcId - 私有网络ID精确匹配支持多个
status - 云主机状态,精确匹配,支持多个,<a href="http://docs.jdcloud.com/virtual-machines/api/vm_status">参考云主机状态</a>
name - 云主机名称,模糊匹配,支持单个
imageId - 镜像ID精确匹配支持多个
networkInterfaceId - 弹性网卡ID精确匹配支持多个
subnetId - 子网ID精确匹配支持多个
agId - 使用可用组id支持单个
faultDomain - 错误域,支持多个
dedicatedHostId - 专有宿主机ID精确匹配支持多个
dedicatedPoolId - 专有宿主机池ID精确匹配支持多个
instanceType - 实例规格,精确匹配,支持多个
elasticIpAddress - 公网IP地址精确匹配支持单个
(Optional)
*/
func NewDescribeBriefInstancesRequestWithAllParams(
regionId string,
pageNumber *int,
pageSize *int,
tags []vm.TagFilter,
filters []common.Filter,
) *DescribeBriefInstancesRequest {
return &DescribeBriefInstancesRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/instances:describeBriefInstances",
Method: "GET",
Header: nil,
Version: "v1",
},
RegionId: regionId,
PageNumber: pageNumber,
PageSize: pageSize,
Tags: tags,
Filters: filters,
}
}
/* This constructor has better compatible ability when API parameters changed */
func NewDescribeBriefInstancesRequestWithoutParam() *DescribeBriefInstancesRequest {
return &DescribeBriefInstancesRequest{
JDCloudRequest: core.JDCloudRequest{
URL: "/regions/{regionId}/instances:describeBriefInstances",
Method: "GET",
Header: nil,
Version: "v1",
},
}
}
/* param regionId: 地域ID(Required) */
func (r *DescribeBriefInstancesRequest) SetRegionId(regionId string) {
r.RegionId = regionId
}
/* param pageNumber: 页码默认为1(Optional) */
func (r *DescribeBriefInstancesRequest) SetPageNumber(pageNumber int) {
r.PageNumber = &pageNumber
}
/* param pageSize: 分页大小默认为20取值范围[10, 100](Optional) */
func (r *DescribeBriefInstancesRequest) SetPageSize(pageSize int) {
r.PageSize = &pageSize
}
/* param tags: Tag筛选条件(Optional) */
func (r *DescribeBriefInstancesRequest) SetTags(tags []vm.TagFilter) {
r.Tags = tags
}
/* param filters: instanceId - 云主机ID精确匹配支持多个
privateIpAddress - 主网卡内网主IP地址模糊匹配支持多个
az - 可用区,精确匹配,支持多个
vpcId - 私有网络ID精确匹配支持多个
status - 云主机状态,精确匹配,支持多个,<a href="http://docs.jdcloud.com/virtual-machines/api/vm_status">参考云主机状态</a>
name - 云主机名称,模糊匹配,支持单个
imageId - 镜像ID精确匹配支持多个
networkInterfaceId - 弹性网卡ID精确匹配支持多个
subnetId - 子网ID精确匹配支持多个
agId - 使用可用组id支持单个
faultDomain - 错误域,支持多个
dedicatedHostId - 专有宿主机ID精确匹配支持多个
dedicatedPoolId - 专有宿主机池ID精确匹配支持多个
instanceType - 实例规格,精确匹配,支持多个
elasticIpAddress - 公网IP地址精确匹配支持单个
(Optional) */
func (r *DescribeBriefInstancesRequest) SetFilters(filters []common.Filter) {
r.Filters = filters
}
// GetRegionId returns path parameter 'regionId' if exist,
// otherwise return empty string
func (r DescribeBriefInstancesRequest) GetRegionId() string {
return r.RegionId
}
type DescribeBriefInstancesResponse struct {
RequestID string `json:"requestId"`
Error core.ErrorResponse `json:"error"`
Result DescribeBriefInstancesResult `json:"result"`
}
type DescribeBriefInstancesResult struct {
Instances []vm.BriefInstance `json:"instances"`
TotalCount int `json:"totalCount"`
}

View File

@@ -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"`
}

View File

@@ -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"`
}

View File

@@ -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"`
}

View File

@@ -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"`
}

Some files were not shown because too many files have changed in this diff Show More