Skip to content

Commit 67083af

Browse files
authored
feat(audit_trail): add last status to export job (scaleway#2764)
1 parent 25a2bd9 commit 67083af

File tree

1 file changed

+53
-3
lines changed

1 file changed

+53
-3
lines changed

api/audit_trail/v1alpha1/audit_trail_sdk.go

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,45 @@ func (enum *AuthenticationEventResult) UnmarshalJSON(data []byte) error {
237237
return nil
238238
}
239239

240+
type ExportJobStatusCode string
241+
242+
const (
243+
ExportJobStatusCodeUnknownCode = ExportJobStatusCode("unknown_code")
244+
ExportJobStatusCodeSuccess = ExportJobStatusCode("success")
245+
ExportJobStatusCodeFailure = ExportJobStatusCode("failure")
246+
)
247+
248+
func (enum ExportJobStatusCode) String() string {
249+
if enum == "" {
250+
// return default value if empty
251+
return string(ExportJobStatusCodeUnknownCode)
252+
}
253+
return string(enum)
254+
}
255+
256+
func (enum ExportJobStatusCode) Values() []ExportJobStatusCode {
257+
return []ExportJobStatusCode{
258+
"unknown_code",
259+
"success",
260+
"failure",
261+
}
262+
}
263+
264+
func (enum ExportJobStatusCode) MarshalJSON() ([]byte, error) {
265+
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
266+
}
267+
268+
func (enum *ExportJobStatusCode) UnmarshalJSON(data []byte) error {
269+
tmp := ""
270+
271+
if err := json.Unmarshal(data, &tmp); err != nil {
272+
return err
273+
}
274+
275+
*enum = ExportJobStatusCode(ExportJobStatusCode(tmp).String())
276+
return nil
277+
}
278+
240279
type ListAuthenticationEventsRequestOrderBy string
241280

242281
const (
@@ -903,6 +942,14 @@ type ExportJobS3 struct {
903942
ProjectID *string `json:"project_id"`
904943
}
905944

945+
// ExportJobStatus: export job status.
946+
type ExportJobStatus struct {
947+
// Code: default value: unknown_code
948+
Code ExportJobStatusCode `json:"code"`
949+
950+
Message *string `json:"message"`
951+
}
952+
906953
// ProductService: product service.
907954
type ProductService struct {
908955
Name string `json:"name"`
@@ -930,7 +977,7 @@ type ExportJob struct {
930977
// OrganizationID: ID of the targeted Organization.
931978
OrganizationID string `json:"organization_id"`
932979

933-
// Name: name of the export.
980+
// Name: name of the export job.
934981
Name string `json:"name"`
935982

936983
// S3: destination in an S3 storage.
@@ -940,11 +987,14 @@ type ExportJob struct {
940987
// CreatedAt: export job creation date.
941988
CreatedAt *time.Time `json:"created_at"`
942989

943-
// LastRunAt: last export date.
990+
// LastRunAt: last run of export job.
944991
LastRunAt *time.Time `json:"last_run_at"`
945992

946-
// Tags: tags of the export.
993+
// Tags: tags of the export job.
947994
Tags map[string]string `json:"tags"`
995+
996+
// LastStatus: status of last export job.
997+
LastStatus *ExportJobStatus `json:"last_status"`
948998
}
949999

9501000
// Product: product.

0 commit comments

Comments
 (0)