Skip to content

Commit

Permalink
Merge pull request #847 from AlexVulaj/log-entry-model-update
Browse files Browse the repository at this point in the history
Update the log entry resources from new model updates
  • Loading branch information
tylercreller authored Sep 27, 2023
2 parents b72ca61 + 01266e1 commit da7d110
Show file tree
Hide file tree
Showing 6 changed files with 380 additions and 253 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
export CGO_ENABLED=0

# Details of the model to use:
model_version:=v0.0.323
model_version:=v0.0.324
model_url:=https://github.com/openshift-online/ocm-api-model.git

# Details of the metamodel to use:
Expand Down
9 changes: 9 additions & 0 deletions openapi/service_logs/v1/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,15 @@
"description": "External cluster ID.",
"type": "string"
},
"created_at": {
"description": "The time at which the cluster log was created.",
"type": "string",
"format": "date-time"
},
"created_by": {
"description": "The name of the user who created the cluster log.",
"type": "string"
},
"description": {
"description": "Full description of the log entry content (supports Markdown format as well).",
"type": "string"
Expand Down
40 changes: 30 additions & 10 deletions servicelogs/v1/log_entry_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ type LogEntryBuilder struct {
href string
clusterID string
clusterUUID string
createdAt time.Time
createdBy string
description string
eventStreamID string
logType LogType
Expand Down Expand Up @@ -86,24 +88,38 @@ func (b *LogEntryBuilder) ClusterUUID(value string) *LogEntryBuilder {
return b
}

// CreatedAt sets the value of the 'created_at' attribute to the given value.
func (b *LogEntryBuilder) CreatedAt(value time.Time) *LogEntryBuilder {
b.createdAt = value
b.bitmap_ |= 32
return b
}

// CreatedBy sets the value of the 'created_by' attribute to the given value.
func (b *LogEntryBuilder) CreatedBy(value string) *LogEntryBuilder {
b.createdBy = value
b.bitmap_ |= 64
return b
}

// Description sets the value of the 'description' attribute to the given value.
func (b *LogEntryBuilder) Description(value string) *LogEntryBuilder {
b.description = value
b.bitmap_ |= 32
b.bitmap_ |= 128
return b
}

// EventStreamID sets the value of the 'event_stream_ID' attribute to the given value.
func (b *LogEntryBuilder) EventStreamID(value string) *LogEntryBuilder {
b.eventStreamID = value
b.bitmap_ |= 64
b.bitmap_ |= 256
return b
}

// InternalOnly sets the value of the 'internal_only' attribute to the given value.
func (b *LogEntryBuilder) InternalOnly(value bool) *LogEntryBuilder {
b.internalOnly = value
b.bitmap_ |= 128
b.bitmap_ |= 512
return b
}

Expand All @@ -112,49 +128,49 @@ func (b *LogEntryBuilder) InternalOnly(value bool) *LogEntryBuilder {
// Representation of the log type field used in cluster log type model.
func (b *LogEntryBuilder) LogType(value LogType) *LogEntryBuilder {
b.logType = value
b.bitmap_ |= 256
b.bitmap_ |= 1024
return b
}

// ServiceName sets the value of the 'service_name' attribute to the given value.
func (b *LogEntryBuilder) ServiceName(value string) *LogEntryBuilder {
b.serviceName = value
b.bitmap_ |= 512
b.bitmap_ |= 2048
return b
}

// Severity sets the value of the 'severity' attribute to the given value.
func (b *LogEntryBuilder) Severity(value Severity) *LogEntryBuilder {
b.severity = value
b.bitmap_ |= 1024
b.bitmap_ |= 4096
return b
}

// SubscriptionID sets the value of the 'subscription_ID' attribute to the given value.
func (b *LogEntryBuilder) SubscriptionID(value string) *LogEntryBuilder {
b.subscriptionID = value
b.bitmap_ |= 2048
b.bitmap_ |= 8192
return b
}

// Summary sets the value of the 'summary' attribute to the given value.
func (b *LogEntryBuilder) Summary(value string) *LogEntryBuilder {
b.summary = value
b.bitmap_ |= 4096
b.bitmap_ |= 16384
return b
}

// Timestamp sets the value of the 'timestamp' attribute to the given value.
func (b *LogEntryBuilder) Timestamp(value time.Time) *LogEntryBuilder {
b.timestamp = value
b.bitmap_ |= 8192
b.bitmap_ |= 32768
return b
}

// Username sets the value of the 'username' attribute to the given value.
func (b *LogEntryBuilder) Username(value string) *LogEntryBuilder {
b.username = value
b.bitmap_ |= 16384
b.bitmap_ |= 65536
return b
}

Expand All @@ -168,6 +184,8 @@ func (b *LogEntryBuilder) Copy(object *LogEntry) *LogEntryBuilder {
b.href = object.href
b.clusterID = object.clusterID
b.clusterUUID = object.clusterUUID
b.createdAt = object.createdAt
b.createdBy = object.createdBy
b.description = object.description
b.eventStreamID = object.eventStreamID
b.internalOnly = object.internalOnly
Expand All @@ -189,6 +207,8 @@ func (b *LogEntryBuilder) Build() (object *LogEntry, err error) {
object.bitmap_ = b.bitmap_
object.clusterID = b.clusterID
object.clusterUUID = b.clusterUUID
object.createdAt = b.createdAt
object.createdBy = b.createdBy
object.description = b.description
object.eventStreamID = b.eventStreamID
object.internalOnly = b.internalOnly
Expand Down
88 changes: 68 additions & 20 deletions servicelogs/v1/log_entry_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ type LogEntry struct {
href string
clusterID string
clusterUUID string
createdAt time.Time
createdBy string
description string
eventStreamID string
logType LogType
Expand Down Expand Up @@ -157,12 +159,58 @@ func (o *LogEntry) GetClusterUUID() (value string, ok bool) {
return
}

// CreatedAt returns the value of the 'created_at' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
// The time at which the cluster log was created.
func (o *LogEntry) CreatedAt() time.Time {
if o != nil && o.bitmap_&32 != 0 {
return o.createdAt
}
return time.Time{}
}

// GetCreatedAt returns the value of the 'created_at' attribute and
// a flag indicating if the attribute has a value.
//
// The time at which the cluster log was created.
func (o *LogEntry) GetCreatedAt() (value time.Time, ok bool) {
ok = o != nil && o.bitmap_&32 != 0
if ok {
value = o.createdAt
}
return
}

// CreatedBy returns the value of the 'created_by' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
// The name of the user who created the cluster log.
func (o *LogEntry) CreatedBy() string {
if o != nil && o.bitmap_&64 != 0 {
return o.createdBy
}
return ""
}

// GetCreatedBy returns the value of the 'created_by' attribute and
// a flag indicating if the attribute has a value.
//
// The name of the user who created the cluster log.
func (o *LogEntry) GetCreatedBy() (value string, ok bool) {
ok = o != nil && o.bitmap_&64 != 0
if ok {
value = o.createdBy
}
return
}

// Description returns the value of the 'description' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
// Full description of the log entry content (supports Markdown format as well).
func (o *LogEntry) Description() string {
if o != nil && o.bitmap_&32 != 0 {
if o != nil && o.bitmap_&128 != 0 {
return o.description
}
return ""
Expand All @@ -173,7 +221,7 @@ func (o *LogEntry) Description() string {
//
// Full description of the log entry content (supports Markdown format as well).
func (o *LogEntry) GetDescription() (value string, ok bool) {
ok = o != nil && o.bitmap_&32 != 0
ok = o != nil && o.bitmap_&128 != 0
if ok {
value = o.description
}
Expand All @@ -185,7 +233,7 @@ func (o *LogEntry) GetDescription() (value string, ok bool) {
//
// Log custom event id for a simple search of related cluster logs.
func (o *LogEntry) EventStreamID() string {
if o != nil && o.bitmap_&64 != 0 {
if o != nil && o.bitmap_&256 != 0 {
return o.eventStreamID
}
return ""
Expand All @@ -196,7 +244,7 @@ func (o *LogEntry) EventStreamID() string {
//
// Log custom event id for a simple search of related cluster logs.
func (o *LogEntry) GetEventStreamID() (value string, ok bool) {
ok = o != nil && o.bitmap_&64 != 0
ok = o != nil && o.bitmap_&256 != 0
if ok {
value = o.eventStreamID
}
Expand All @@ -208,7 +256,7 @@ func (o *LogEntry) GetEventStreamID() (value string, ok bool) {
//
// A flag that indicates whether the log entry should be internal/private only.
func (o *LogEntry) InternalOnly() bool {
if o != nil && o.bitmap_&128 != 0 {
if o != nil && o.bitmap_&512 != 0 {
return o.internalOnly
}
return false
Expand All @@ -219,7 +267,7 @@ func (o *LogEntry) InternalOnly() bool {
//
// A flag that indicates whether the log entry should be internal/private only.
func (o *LogEntry) GetInternalOnly() (value bool, ok bool) {
ok = o != nil && o.bitmap_&128 != 0
ok = o != nil && o.bitmap_&512 != 0
if ok {
value = o.internalOnly
}
Expand All @@ -231,7 +279,7 @@ func (o *LogEntry) GetInternalOnly() (value bool, ok bool) {
//
// Type of the service log entry.
func (o *LogEntry) LogType() LogType {
if o != nil && o.bitmap_&256 != 0 {
if o != nil && o.bitmap_&1024 != 0 {
return o.logType
}
return LogType("")
Expand All @@ -242,7 +290,7 @@ func (o *LogEntry) LogType() LogType {
//
// Type of the service log entry.
func (o *LogEntry) GetLogType() (value LogType, ok bool) {
ok = o != nil && o.bitmap_&256 != 0
ok = o != nil && o.bitmap_&1024 != 0
if ok {
value = o.logType
}
Expand All @@ -254,7 +302,7 @@ func (o *LogEntry) GetLogType() (value LogType, ok bool) {
//
// The name of the service who created the log.
func (o *LogEntry) ServiceName() string {
if o != nil && o.bitmap_&512 != 0 {
if o != nil && o.bitmap_&2048 != 0 {
return o.serviceName
}
return ""
Expand All @@ -265,7 +313,7 @@ func (o *LogEntry) ServiceName() string {
//
// The name of the service who created the log.
func (o *LogEntry) GetServiceName() (value string, ok bool) {
ok = o != nil && o.bitmap_&512 != 0
ok = o != nil && o.bitmap_&2048 != 0
if ok {
value = o.serviceName
}
Expand All @@ -277,7 +325,7 @@ func (o *LogEntry) GetServiceName() (value string, ok bool) {
//
// Log severity for the specific log entry.
func (o *LogEntry) Severity() Severity {
if o != nil && o.bitmap_&1024 != 0 {
if o != nil && o.bitmap_&4096 != 0 {
return o.severity
}
return Severity("")
Expand All @@ -288,7 +336,7 @@ func (o *LogEntry) Severity() Severity {
//
// Log severity for the specific log entry.
func (o *LogEntry) GetSeverity() (value Severity, ok bool) {
ok = o != nil && o.bitmap_&1024 != 0
ok = o != nil && o.bitmap_&4096 != 0
if ok {
value = o.severity
}
Expand All @@ -300,7 +348,7 @@ func (o *LogEntry) GetSeverity() (value Severity, ok bool) {
//
// The related subscription id of the cluster.
func (o *LogEntry) SubscriptionID() string {
if o != nil && o.bitmap_&2048 != 0 {
if o != nil && o.bitmap_&8192 != 0 {
return o.subscriptionID
}
return ""
Expand All @@ -311,7 +359,7 @@ func (o *LogEntry) SubscriptionID() string {
//
// The related subscription id of the cluster.
func (o *LogEntry) GetSubscriptionID() (value string, ok bool) {
ok = o != nil && o.bitmap_&2048 != 0
ok = o != nil && o.bitmap_&8192 != 0
if ok {
value = o.subscriptionID
}
Expand All @@ -323,7 +371,7 @@ func (o *LogEntry) GetSubscriptionID() (value string, ok bool) {
//
// Title of the log entry.
func (o *LogEntry) Summary() string {
if o != nil && o.bitmap_&4096 != 0 {
if o != nil && o.bitmap_&16384 != 0 {
return o.summary
}
return ""
Expand All @@ -334,7 +382,7 @@ func (o *LogEntry) Summary() string {
//
// Title of the log entry.
func (o *LogEntry) GetSummary() (value string, ok bool) {
ok = o != nil && o.bitmap_&4096 != 0
ok = o != nil && o.bitmap_&16384 != 0
if ok {
value = o.summary
}
Expand All @@ -344,7 +392,7 @@ func (o *LogEntry) GetSummary() (value string, ok bool) {
// Timestamp returns the value of the 'timestamp' attribute, or
// the zero value of the type if the attribute doesn't have a value.
func (o *LogEntry) Timestamp() time.Time {
if o != nil && o.bitmap_&8192 != 0 {
if o != nil && o.bitmap_&32768 != 0 {
return o.timestamp
}
return time.Time{}
Expand All @@ -353,7 +401,7 @@ func (o *LogEntry) Timestamp() time.Time {
// GetTimestamp returns the value of the 'timestamp' attribute and
// a flag indicating if the attribute has a value.
func (o *LogEntry) GetTimestamp() (value time.Time, ok bool) {
ok = o != nil && o.bitmap_&8192 != 0
ok = o != nil && o.bitmap_&32768 != 0
if ok {
value = o.timestamp
}
Expand All @@ -365,7 +413,7 @@ func (o *LogEntry) GetTimestamp() (value time.Time, ok bool) {
//
// The username that triggered the event (if available).
func (o *LogEntry) Username() string {
if o != nil && o.bitmap_&16384 != 0 {
if o != nil && o.bitmap_&65536 != 0 {
return o.username
}
return ""
Expand All @@ -376,7 +424,7 @@ func (o *LogEntry) Username() string {
//
// The username that triggered the event (if available).
func (o *LogEntry) GetUsername() (value string, ok bool) {
ok = o != nil && o.bitmap_&16384 != 0
ok = o != nil && o.bitmap_&65536 != 0
if ok {
value = o.username
}
Expand Down
Loading

0 comments on commit da7d110

Please sign in to comment.