mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-06-20 14:36:09 +08:00
fix(region): vendor update (#23844)
This commit is contained in:
2
go.mod
2
go.mod
@@ -97,7 +97,7 @@ require (
|
||||
k8s.io/cri-api v0.28.15
|
||||
k8s.io/klog/v2 v2.20.0
|
||||
moul.io/http2curl/v2 v2.3.0
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251125082612-fe4c7619db15
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251125125826-86ba3f3b2538
|
||||
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0
|
||||
yunion.io/x/jsonutils v1.0.1-0.20250507052344-1abcf4f443b1
|
||||
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
|
||||
|
||||
4
go.sum
4
go.sum
@@ -1672,8 +1672,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
|
||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251125082612-fe4c7619db15 h1:T2C5B/ivpWmc0EpcH0PbUGFoZkq5gNG7erTtJdjyJXo=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251125082612-fe4c7619db15/go.mod h1:JlmQ8iuGdaAlUkivFVcUAJgi6QYr5jz1vKv7pQ5m7p8=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251125125826-86ba3f3b2538 h1:EAQ0YtCUwX9tsyEDrSfvQ023YulkFwEGm0NrLPGmc2g=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251125125826-86ba3f3b2538/go.mod h1:JlmQ8iuGdaAlUkivFVcUAJgi6QYr5jz1vKv7pQ5m7p8=
|
||||
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0 h1:msG4SiDSVU7CrXH06WuHlNEZXIooTcmNbfrIGHuIHBU=
|
||||
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
|
||||
@@ -50,6 +50,12 @@ func AlertHistoryReport(ctx context.Context, userCred mcclient.TokenCredential,
|
||||
}
|
||||
metrics := []influxdb.SMetricData{}
|
||||
for _, alert := range alerts.Data {
|
||||
if alert.ResType == "host" && len(alert.DomainId) == 0 {
|
||||
continue
|
||||
}
|
||||
if alert.ResType == "guest" && len(alert.ProjectId) == 0 {
|
||||
continue
|
||||
}
|
||||
metric := influxdb.SMetricData{}
|
||||
metric.Name = ALERT_RECORD_HISTORY_MEASUREMENT
|
||||
metric.Timestamp = time.Now()
|
||||
|
||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -2264,7 +2264,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
|
||||
# sigs.k8s.io/yaml v1.2.0
|
||||
## explicit; go 1.12
|
||||
sigs.k8s.io/yaml
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251125082612-fe4c7619db15
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251125125826-86ba3f3b2538
|
||||
## explicit; go 1.24
|
||||
yunion.io/x/cloudmux/pkg/apis
|
||||
yunion.io/x/cloudmux/pkg/apis/billing
|
||||
|
||||
79
vendor/yunion.io/x/cloudmux/pkg/multicloud/volcengine/instance.go
generated
vendored
79
vendor/yunion.io/x/cloudmux/pkg/multicloud/volcengine/instance.go
generated
vendored
@@ -249,6 +249,85 @@ func (instance *SInstance) GetInstanceType() string {
|
||||
return instance.InstanceTypeId
|
||||
}
|
||||
|
||||
func (instance *SInstance) SetTags(tags map[string]string, replace bool) error {
|
||||
_tags, err := instance.GetTags()
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "GetTags")
|
||||
}
|
||||
keys, upperKeys := []string{}, []string{}
|
||||
for k := range tags {
|
||||
keys = append(keys, k)
|
||||
upperKeys = append(upperKeys, strings.ToUpper(k))
|
||||
}
|
||||
if replace {
|
||||
if len(tags) > 0 {
|
||||
removeKeys := []string{}
|
||||
for k := range _tags {
|
||||
if !utils.IsInStringArray(k, keys) {
|
||||
removeKeys = append(removeKeys, k)
|
||||
}
|
||||
}
|
||||
if len(removeKeys) > 0 {
|
||||
err := instance.host.zone.region.UntagResources(instance.InstanceId, "instance", removeKeys)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "UntagResource")
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
removeKeys := []string{}
|
||||
for k := range _tags {
|
||||
if !utils.IsInStringArray(k, keys) && utils.IsInStringArray(strings.ToUpper(k), upperKeys) {
|
||||
removeKeys = append(removeKeys, k)
|
||||
}
|
||||
}
|
||||
if len(removeKeys) > 0 {
|
||||
err := instance.host.zone.region.UntagResources(instance.InstanceId, "instance", removeKeys)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "UntagResource")
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance.host.zone.region.TagResources(instance.InstanceId, "instance", tags)
|
||||
}
|
||||
|
||||
func (region *SRegion) TagResources(resId, resType string, tags map[string]string) error {
|
||||
params := map[string]string{
|
||||
"ResourceIds.1": resId,
|
||||
"ResourceType": resType,
|
||||
}
|
||||
idx := 1
|
||||
for k, v := range tags {
|
||||
params[fmt.Sprintf("Tags.%d.Key", idx)] = k
|
||||
params[fmt.Sprintf("Tags.%d.Value", idx)] = v
|
||||
idx++
|
||||
}
|
||||
|
||||
_, err := region.ecsRequest("TagResources", params)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "TagResources")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (region *SRegion) UntagResources(resId, resType string, tags []string) error {
|
||||
params := map[string]string{
|
||||
"ResourceIds.1": resId,
|
||||
"ResourceType": resType,
|
||||
}
|
||||
idx := 1
|
||||
for _, tag := range tags {
|
||||
params[fmt.Sprintf("TagKeys.%d", idx)] = tag
|
||||
idx++
|
||||
}
|
||||
|
||||
_, err := region.ecsRequest("UntagResources", params)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "UntagResources")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (instance *SInstance) GetSecurityGroupIds() ([]string, error) {
|
||||
nics, err := instance.host.zone.region.GetNetworkInterfaces("", instance.InstanceId)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user