feat: add instance change pricing and catalog metadata
test / go (push) Successful in 51s

This commit is contained in:
shiran
2026-08-31 16:40:43 +08:00
parent 8392db9ae3
commit 0a1b3ac8c0
6 changed files with 215 additions and 37 deletions
+24 -16
View File
@@ -37,7 +37,8 @@ type EIPInfo struct {
Available []map[string]any `json:"available"`
}
type EnsureEIPRequest struct {
AllocationID string `json:"allocation_id,omitempty"`
AllocationID string `json:"allocation_id,omitempty"`
ExpectedConfigurationFingerprint string `json:"expected_configuration_fingerprint,omitempty"`
}
type ReverseDNSRequest struct {
DomainName string `json:"domain_name,omitempty"`
@@ -63,25 +64,27 @@ func (s *EIPService) SetReverseDNS(ctx context.Context, region, instanceID strin
type Volume map[string]any
type CreateVolumeRequest struct {
Name string `json:"name,omitempty"`
DeviceName string `json:"device_name"`
SizeGiB int32 `json:"size_gib"`
Type string `json:"type,omitempty"`
IOPS int32 `json:"iops,omitempty"`
Throughput int32 `json:"throughput,omitempty"`
Encrypted bool `json:"encrypted"`
KMSKeyID string `json:"kms_key_id,omitempty"`
DeleteOnTermination bool `json:"delete_on_termination"`
Name string `json:"name,omitempty"`
DeviceName string `json:"device_name"`
SizeGiB int32 `json:"size_gib"`
Type string `json:"type,omitempty"`
IOPS int32 `json:"iops,omitempty"`
Throughput int32 `json:"throughput,omitempty"`
Encrypted bool `json:"encrypted"`
KMSKeyID string `json:"kms_key_id,omitempty"`
DeleteOnTermination bool `json:"delete_on_termination"`
ExpectedConfigurationFingerprint string `json:"expected_configuration_fingerprint,omitempty"`
}
type AttachVolumeRequest struct {
DeviceName string `json:"device_name"`
DeleteOnTermination bool `json:"delete_on_termination"`
}
type ModifyVolumeRequest struct {
SizeGiB int32 `json:"size_gib,omitempty"`
Type string `json:"type,omitempty"`
IOPS int32 `json:"iops,omitempty"`
Throughput int32 `json:"throughput,omitempty"`
SizeGiB int32 `json:"size_gib,omitempty"`
Type string `json:"type,omitempty"`
IOPS int32 `json:"iops,omitempty"`
Throughput int32 `json:"throughput,omitempty"`
ExpectedConfigurationFingerprint string `json:"expected_configuration_fingerprint,omitempty"`
}
func (s *VolumeService) List(ctx context.Context, region, instanceID string) ([]Volume, error) {
@@ -109,8 +112,9 @@ func (s *VolumeService) Delete(ctx context.Context, region, instanceID, volumeID
type TrafficLimit map[string]any
type TrafficLimitRequest struct {
Enabled *bool `json:"enabled,omitempty"`
LimitGiB *float64 `json:"limit_gib,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
LimitGiB *float64 `json:"limit_gib,omitempty"`
ExpectedConfigurationFingerprint string `json:"expected_configuration_fingerprint,omitempty"`
}
func (s *TrafficService) Get(ctx context.Context, region, instanceID string) (TrafficLimit, error) {
@@ -123,3 +127,7 @@ func (s *TrafficService) Update(ctx context.Context, region, instanceID string,
err := s.client.do(ctx, http.MethodPatch, instancesPath(region, instanceID)+"/traffic-limit", input, &result, newID())
return result, err
}
func (s *TrafficService) UpdateAsync(ctx context.Context, region, instanceID string, input TrafficLimitRequest, options ...RequestOption) (*Operation, error) {
return (&InstancesService{client: s.client}).operation(ctx, http.MethodPost, instancesPath(region, instanceID)+"/traffic-limit/update", input, options...)
}