This commit is contained in:
2025-11-18 16:20:26 +03:00
parent 4b3f21d9be
commit e42fbcef39
397 changed files with 17560 additions and 1501 deletions

View File

@@ -43,6 +43,7 @@ func flattenAudit(d *schema.ResourceData, au *audit.RecordAudit) {
d.Set("args", au.Arguments)
d.Set("call", au.Call)
d.Set("correlation_id", au.CorrelationID)
d.Set("guid", au.GUID)
d.Set("kwargs", au.Kwargs)
d.Set("remote_addr", au.RemoteAddr)
@@ -60,19 +61,19 @@ func flattenAuditList(au *audit.ListAudits) []map[string]interface{} {
res := make([]map[string]interface{}, 0, len(au.Data))
for _, item := range au.Data {
temp := map[string]interface{}{
"args": item.Args,
"call": item.Call,
"guid": item.GUID,
"kwargs": item.Kwargs,
"remote_addr": item.RemoteAddr,
"result": item.Result,
"responsetime": item.ResponseTime,
"status_code": item.StatusCode,
"tags": item.Tags,
"timestamp": item.Timestamp,
"timestamp_end": item.TimestampEnd,
"ttl": item.TTL,
"user": item.User,
"args": item.Args,
"call": item.Call,
"correlation_id": item.CorrelationID,
"guid": item.GUID,
"kwargs": item.Kwargs,
"remote_addr": item.RemoteAddr,
"result": item.Result,
"responsetime": item.ResponseTime,
"status_code": item.StatusCode,
"timestamp": item.Timestamp,
"timestamp_end": item.TimestampEnd,
"ttl": item.TTL,
"user": item.User,
}
res = append(res, temp)
}

View File

@@ -18,6 +18,10 @@ func dataSourceAuditSchemaMake() map[string]*schema.Schema {
Type: schema.TypeString,
Computed: true,
},
"correlation_id": {
Type: schema.TypeString,
Computed: true,
},
"guid": {
Type: schema.TypeString,
Computed: true,
@@ -42,10 +46,11 @@ func dataSourceAuditSchemaMake() map[string]*schema.Schema {
Type: schema.TypeInt,
Computed: true,
},
"tags": {
Type: schema.TypeString,
Computed: true,
},
//TODO
//"tags": {
// Type: schema.TypeString,
// Computed: true,
//},
"timestamp": {
Type: schema.TypeFloat,
Computed: true,
@@ -117,6 +122,50 @@ func dataSourceAuditListSchemaMake() map[string]*schema.Schema {
Optional: true,
Description: "page size",
},
"resgroup_id": {
Type: schema.TypeInt,
Optional: true,
},
"compute_id": {
Type: schema.TypeInt,
Optional: true,
},
"account_id": {
Type: schema.TypeInt,
Optional: true,
},
"vins_id": {
Type: schema.TypeInt,
Optional: true,
},
"service_id": {
Type: schema.TypeInt,
Optional: true,
},
"k8s_id": {
Type: schema.TypeInt,
Optional: true,
},
"flipgroup_id": {
Type: schema.TypeInt,
Optional: true,
},
"lb_id": {
Type: schema.TypeInt,
Optional: true,
},
"sep_id": {
Type: schema.TypeInt,
Optional: true,
},
"node_id": {
Type: schema.TypeInt,
Optional: true,
},
"exclude_audit_lines": {
Type: schema.TypeBool,
Optional: true,
},
"items": {
Type: schema.TypeList,
Computed: true,
@@ -126,6 +175,10 @@ func dataSourceAuditListSchemaMake() map[string]*schema.Schema {
Type: schema.TypeString,
Computed: true,
},
"correlation_id": {
Type: schema.TypeString,
Computed: true,
},
"guid": {
Type: schema.TypeString,
Computed: true,
@@ -170,10 +223,6 @@ func dataSourceAuditListSchemaMake() map[string]*schema.Schema {
Type: schema.TypeString,
Computed: true,
},
"tags": {
Type: schema.TypeString,
Computed: true,
},
},
},
},

View File

@@ -76,6 +76,39 @@ func utilityAuditListCheckPresence(ctx context.Context, d *schema.ResourceData,
if Size, ok := d.GetOk("size"); ok {
req.Size = uint64(Size.(int))
}
if resgroupID, ok := d.GetOk("resgroup_id"); ok {
req.RGID = uint64(resgroupID.(int))
}
if computeID, ok := d.GetOk("compute_id"); ok {
req.ComputeID = uint64(computeID.(int))
}
if accountID, ok := d.GetOk("account_id"); ok {
req.AccountID = uint64(accountID.(int))
}
if vinsID, ok := d.GetOk("vins_id"); ok {
req.VINSID = uint64(vinsID.(int))
}
if serviceID, ok := d.GetOk("service_id"); ok {
req.ServiceID = uint64(serviceID.(int))
}
if k8sID, ok := d.GetOk("k8s_id"); ok {
req.K8SID = uint64(k8sID.(int))
}
if flipgroupID, ok := d.GetOk("flipgroup_id"); ok {
req.FLIPGroupID = uint64(flipgroupID.(int))
}
if lbID, ok := d.GetOk("lb_id"); ok {
req.LBID = uint64(lbID.(int))
}
if sepID, ok := d.GetOk("sep_id"); ok {
req.SEPID = uint64(sepID.(int))
}
if nodeID, ok := d.GetOk("node_id"); ok {
req.NodeID = uint64(nodeID.(int))
}
if excludeAuditLines, ok := d.GetOk("exclude_audit_lines"); ok {
req.ExcludeAuditLines = excludeAuditLines.(bool)
}
log.Debugf("utilityAuditListCheckPresence: load audit list")
auditList, err := c.CloudBroker().Audit().List(ctx, req)