Skip to content

Commit

Permalink
Support audit log forwarding in cs
Browse files Browse the repository at this point in the history
Update open-api-model version

revert some changes
  • Loading branch information
davidleerh committed Apr 26, 2023
1 parent e1fcd42 commit 3ced6e6
Show file tree
Hide file tree
Showing 11 changed files with 9,155 additions and 8,615 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.278
model_version:=v0.0.279
model_url:=https://github.com/openshift-online/ocm-api-model.git

# Details of the metamodel to use:
Expand Down
63 changes: 63 additions & 0 deletions clustersmgmt/v1/audit_log_builder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
Copyright (c) 2020 Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// IMPORTANT: This file has been generated automatically, refrain from modifying it manually as all
// your changes will be lost when the file is generated again.

package v1 // github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1

// AuditLogBuilder contains the data and logic needed to build 'audit_log' objects.
//
// Contains the necessary attributes to support audit log forwarding
type AuditLogBuilder struct {
bitmap_ uint32
roleArn string
}

// NewAuditLog creates a new builder of 'audit_log' objects.
func NewAuditLog() *AuditLogBuilder {
return &AuditLogBuilder{}
}

// Empty returns true if the builder is empty, i.e. no attribute has a value.
func (b *AuditLogBuilder) Empty() bool {
return b == nil || b.bitmap_ == 0
}

// RoleArn sets the value of the 'role_arn' attribute to the given value.
func (b *AuditLogBuilder) RoleArn(value string) *AuditLogBuilder {
b.roleArn = value
b.bitmap_ |= 1
return b
}

// Copy copies the attributes of the given object into this builder, discarding any previous values.
func (b *AuditLogBuilder) Copy(object *AuditLog) *AuditLogBuilder {
if object == nil {
return b
}
b.bitmap_ = object.bitmap_
b.roleArn = object.roleArn
return b
}

// Build creates a 'audit_log' object using the configuration stored in the builder.
func (b *AuditLogBuilder) Build() (object *AuditLog, err error) {
object = new(AuditLog)
object.bitmap_ = b.bitmap_
object.roleArn = b.roleArn
return
}
71 changes: 71 additions & 0 deletions clustersmgmt/v1/audit_log_list_builder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
Copyright (c) 2020 Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// IMPORTANT: This file has been generated automatically, refrain from modifying it manually as all
// your changes will be lost when the file is generated again.

package v1 // github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1

// AuditLogListBuilder contains the data and logic needed to build
// 'audit_log' objects.
type AuditLogListBuilder struct {
items []*AuditLogBuilder
}

// NewAuditLogList creates a new builder of 'audit_log' objects.
func NewAuditLogList() *AuditLogListBuilder {
return new(AuditLogListBuilder)
}

// Items sets the items of the list.
func (b *AuditLogListBuilder) Items(values ...*AuditLogBuilder) *AuditLogListBuilder {
b.items = make([]*AuditLogBuilder, len(values))
copy(b.items, values)
return b
}

// Empty returns true if the list is empty.
func (b *AuditLogListBuilder) Empty() bool {
return b == nil || len(b.items) == 0
}

// Copy copies the items of the given list into this builder, discarding any previous items.
func (b *AuditLogListBuilder) Copy(list *AuditLogList) *AuditLogListBuilder {
if list == nil || list.items == nil {
b.items = nil
} else {
b.items = make([]*AuditLogBuilder, len(list.items))
for i, v := range list.items {
b.items[i] = NewAuditLog().Copy(v)
}
}
return b
}

// Build creates a list of 'audit_log' objects using the
// configuration stored in the builder.
func (b *AuditLogListBuilder) Build() (list *AuditLogList, err error) {
items := make([]*AuditLog, len(b.items))
for i, item := range b.items {
items[i], err = item.Build()
if err != nil {
return
}
}
list = new(AuditLogList)
list.items = items
return
}
75 changes: 75 additions & 0 deletions clustersmgmt/v1/audit_log_list_type_json.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
Copyright (c) 2020 Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// IMPORTANT: This file has been generated automatically, refrain from modifying it manually as all
// your changes will be lost when the file is generated again.

package v1 // github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1

import (
"io"

jsoniter "github.com/json-iterator/go"
"github.com/openshift-online/ocm-sdk-go/helpers"
)

// MarshalAuditLogList writes a list of values of the 'audit_log' type to
// the given writer.
func MarshalAuditLogList(list []*AuditLog, writer io.Writer) error {
stream := helpers.NewStream(writer)
writeAuditLogList(list, stream)
err := stream.Flush()
if err != nil {
return err
}
return stream.Error
}

// writeAuditLogList writes a list of value of the 'audit_log' type to
// the given stream.
func writeAuditLogList(list []*AuditLog, stream *jsoniter.Stream) {
stream.WriteArrayStart()
for i, value := range list {
if i > 0 {
stream.WriteMore()
}
writeAuditLog(value, stream)
}
stream.WriteArrayEnd()
}

// UnmarshalAuditLogList reads a list of values of the 'audit_log' type
// from the given source, which can be a slice of bytes, a string or a reader.
func UnmarshalAuditLogList(source interface{}) (items []*AuditLog, err error) {
iterator, err := helpers.NewIterator(source)
if err != nil {
return
}
items = readAuditLogList(iterator)
err = iterator.Error
return
}

// readAuditLogList reads list of values of the ”audit_log' type from
// the given iterator.
func readAuditLogList(iterator *jsoniter.Iterator) []*AuditLog {
list := []*AuditLog{}
for iterator.ReadArray() {
item := readAuditLog(iterator)
list = append(list, item)
}
return list
}
142 changes: 142 additions & 0 deletions clustersmgmt/v1/audit_log_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/*
Copyright (c) 2020 Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// IMPORTANT: This file has been generated automatically, refrain from modifying it manually as all
// your changes will be lost when the file is generated again.

package v1 // github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1

// AuditLog represents the values of the 'audit_log' type.
//
// Contains the necessary attributes to support audit log forwarding
type AuditLog struct {
bitmap_ uint32
roleArn string
}

// Empty returns true if the object is empty, i.e. no attribute has a value.
func (o *AuditLog) Empty() bool {
return o == nil || o.bitmap_ == 0
}

// RoleArn returns the value of the 'role_arn' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
// ARN of the CloudWatch audit log forwarding role
func (o *AuditLog) RoleArn() string {
if o != nil && o.bitmap_&1 != 0 {
return o.roleArn
}
return ""
}

// GetRoleArn returns the value of the 'role_arn' attribute and
// a flag indicating if the attribute has a value.
//
// ARN of the CloudWatch audit log forwarding role
func (o *AuditLog) GetRoleArn() (value string, ok bool) {
ok = o != nil && o.bitmap_&1 != 0
if ok {
value = o.roleArn
}
return
}

// AuditLogListKind is the name of the type used to represent list of objects of
// type 'audit_log'.
const AuditLogListKind = "AuditLogList"

// AuditLogListLinkKind is the name of the type used to represent links to list
// of objects of type 'audit_log'.
const AuditLogListLinkKind = "AuditLogListLink"

// AuditLogNilKind is the name of the type used to nil lists of objects of
// type 'audit_log'.
const AuditLogListNilKind = "AuditLogListNil"

// AuditLogList is a list of values of the 'audit_log' type.
type AuditLogList struct {
href string
link bool
items []*AuditLog
}

// Len returns the length of the list.
func (l *AuditLogList) Len() int {
if l == nil {
return 0
}
return len(l.items)
}

// Empty returns true if the list is empty.
func (l *AuditLogList) Empty() bool {
return l == nil || len(l.items) == 0
}

// Get returns the item of the list with the given index. If there is no item with
// that index it returns nil.
func (l *AuditLogList) Get(i int) *AuditLog {
if l == nil || i < 0 || i >= len(l.items) {
return nil
}
return l.items[i]
}

// Slice returns an slice containing the items of the list. The returned slice is a
// copy of the one used internally, so it can be modified without affecting the
// internal representation.
//
// If you don't need to modify the returned slice consider using the Each or Range
// functions, as they don't need to allocate a new slice.
func (l *AuditLogList) Slice() []*AuditLog {
var slice []*AuditLog
if l == nil {
slice = make([]*AuditLog, 0)
} else {
slice = make([]*AuditLog, len(l.items))
copy(slice, l.items)
}
return slice
}

// Each runs the given function for each item of the list, in order. If the function
// returns false the iteration stops, otherwise it continues till all the elements
// of the list have been processed.
func (l *AuditLogList) Each(f func(item *AuditLog) bool) {
if l == nil {
return
}
for _, item := range l.items {
if !f(item) {
break
}
}
}

// Range runs the given function for each index and item of the list, in order. If
// the function returns false the iteration stops, otherwise it continues till all
// the elements of the list have been processed.
func (l *AuditLogList) Range(f func(index int, item *AuditLog) bool) {
if l == nil {
return
}
for index, item := range l.items {
if !f(index, item) {
break
}
}
}
Loading

0 comments on commit 3ced6e6

Please sign in to comment.