-
Notifications
You must be signed in to change notification settings - Fork 7
/
results.go
91 lines (80 loc) · 2.49 KB
/
results.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package configurations
import (
"github.com/huaweicloud/terraform-provider-hcs/huaweicloudstack/sdk/huaweicloud"
)
type ConfigurationCreate struct {
//Configuration ID
Id string `json:"id"`
//Configuration Name
Name string `json:"name"`
//Database version Name
DatastoreVersionName string `json:"datastore_version_name"`
//Database Name
DatastoreName string `json:"datastore_name"`
//Configuration Description
Description string `json:"description"`
}
type Configuration struct {
//Configuration ID
Id string `json:"id"`
//Configuration Name
Name string `json:"name"`
//Database version Name
DatastoreVersionName string `json:"datastore_version_name"`
//Database Name
DatastoreName string `json:"datastore_name"`
//Configuration Description
Description string `json:"description"`
//Configuration Parameters
Parameters []Parameter `json:"configuration_parameters"`
}
type Parameter struct {
//Parameter Name
Name string `json:"name"`
//Parameter value
Value string `json:"value"`
//Whether a restart is required
RestartRequired bool `json:"restart_required"`
//Whether the parameter is read-only
ReadOnly bool `json:"readonly"`
//Parameter value range
ValueRange string `json:"value_range"`
//Parameter type
Type string `json:"type"`
//Parameter description
Description string `json:"description"`
}
// Extract is a function that accepts a result and extracts a configuration.
func (r CreateResult) Extract() (*ConfigurationCreate, error) {
var response ConfigurationCreate
err := r.ExtractInto(&response)
return &response, err
}
func (r CreateResult) ExtractInto(v interface{}) error {
return r.Result.ExtractIntoStructPtr(v, "configuration")
}
// CreateResult represents the result of a create operation. Call its Extract
// method to interpret it as a Configuration.
type CreateResult struct {
golangsdk.Result
}
// UpdateResult represents the result of a update operation.
type UpdateResult struct {
golangsdk.ErrResult
}
// Extract is a function that accepts a result and extracts a configuration.
func (r GetResult) Extract() (*Configuration, error) {
var response Configuration
err := r.ExtractInto(&response)
return &response, err
}
// GetResult represents the result of a get operation. Call its Extract
// method to interpret it as a Configuration.
type GetResult struct {
golangsdk.Result
}
// DeleteResult represents the result of a delete operation. Call its ExtractErr
// method to determine if the request succeeded or failed.
type DeleteResult struct {
golangsdk.ErrResult
}