Skip to content

Commit

Permalink
OCM-6535 | feat: changes to support sts arbitrary policies
Browse files Browse the repository at this point in the history
  • Loading branch information
davidleerh committed Apr 24, 2024
1 parent 7d2bcd1 commit 430f6c2
Show file tree
Hide file tree
Showing 22 changed files with 27,893 additions and 25,552 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export PATH := $(LOCAL_BIN_PATH):$(PATH)
export CGO_ENABLED=0

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

# Details of the metamodel to use:
Expand Down
8 changes: 8 additions & 0 deletions clustersmgmt/v1/aws_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,11 @@ func (c *AWSClient) PrivateLinkConfiguration() *PrivateLinkConfigurationClient {
path.Join(c.path, "private_link_configuration"),
)
}

// RolePolicyBindings returns the target 'role_policy_bindings' resource.
func (c *AWSClient) RolePolicyBindings() *RolePolicyBindingsClient {
return NewRolePolicyBindingsClient(
c.transport,
path.Join(c.path, "role_policy_bindings"),
)
}
51,329 changes: 25,779 additions & 25,550 deletions clustersmgmt/v1/openapi.go

Large diffs are not rendered by default.

130 changes: 130 additions & 0 deletions clustersmgmt/v1/role_policy_binding_builder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/*
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

// RolePolicyBindingBuilder contains the data and logic needed to build 'role_policy_binding' objects.
type RolePolicyBindingBuilder struct {
bitmap_ uint32
arn string
name string
policies []*RolePolicyBuilder
status *RolePolicyBindingStatusBuilder
type_ string
}

// NewRolePolicyBinding creates a new builder of 'role_policy_binding' objects.
func NewRolePolicyBinding() *RolePolicyBindingBuilder {
return &RolePolicyBindingBuilder{}
}

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

// Arn sets the value of the 'arn' attribute to the given value.
func (b *RolePolicyBindingBuilder) Arn(value string) *RolePolicyBindingBuilder {
b.arn = value
b.bitmap_ |= 1
return b
}

// Name sets the value of the 'name' attribute to the given value.
func (b *RolePolicyBindingBuilder) Name(value string) *RolePolicyBindingBuilder {
b.name = value
b.bitmap_ |= 2
return b
}

// Policies sets the value of the 'policies' attribute to the given values.
func (b *RolePolicyBindingBuilder) Policies(values ...*RolePolicyBuilder) *RolePolicyBindingBuilder {
b.policies = make([]*RolePolicyBuilder, len(values))
copy(b.policies, values)
b.bitmap_ |= 4
return b
}

// Status sets the value of the 'status' attribute to the given value.
func (b *RolePolicyBindingBuilder) Status(value *RolePolicyBindingStatusBuilder) *RolePolicyBindingBuilder {
b.status = value
if value != nil {
b.bitmap_ |= 8
} else {
b.bitmap_ &^= 8
}
return b
}

// Type sets the value of the 'type' attribute to the given value.
func (b *RolePolicyBindingBuilder) Type(value string) *RolePolicyBindingBuilder {
b.type_ = value
b.bitmap_ |= 16
return b
}

// Copy copies the attributes of the given object into this builder, discarding any previous values.
func (b *RolePolicyBindingBuilder) Copy(object *RolePolicyBinding) *RolePolicyBindingBuilder {
if object == nil {
return b
}
b.bitmap_ = object.bitmap_
b.arn = object.arn
b.name = object.name
if object.policies != nil {
b.policies = make([]*RolePolicyBuilder, len(object.policies))
for i, v := range object.policies {
b.policies[i] = NewRolePolicy().Copy(v)
}
} else {
b.policies = nil
}
if object.status != nil {
b.status = NewRolePolicyBindingStatus().Copy(object.status)
} else {
b.status = nil
}
b.type_ = object.type_
return b
}

// Build creates a 'role_policy_binding' object using the configuration stored in the builder.
func (b *RolePolicyBindingBuilder) Build() (object *RolePolicyBinding, err error) {
object = new(RolePolicyBinding)
object.bitmap_ = b.bitmap_
object.arn = b.arn
object.name = b.name
if b.policies != nil {
object.policies = make([]*RolePolicy, len(b.policies))
for i, v := range b.policies {
object.policies[i], err = v.Build()
if err != nil {
return
}
}
}
if b.status != nil {
object.status, err = b.status.Build()
if err != nil {
return
}
}
object.type_ = b.type_
return
}
71 changes: 71 additions & 0 deletions clustersmgmt/v1/role_policy_binding_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

// RolePolicyBindingListBuilder contains the data and logic needed to build
// 'role_policy_binding' objects.
type RolePolicyBindingListBuilder struct {
items []*RolePolicyBindingBuilder
}

// NewRolePolicyBindingList creates a new builder of 'role_policy_binding' objects.
func NewRolePolicyBindingList() *RolePolicyBindingListBuilder {
return new(RolePolicyBindingListBuilder)
}

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

// Empty returns true if the list is empty.
func (b *RolePolicyBindingListBuilder) 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 *RolePolicyBindingListBuilder) Copy(list *RolePolicyBindingList) *RolePolicyBindingListBuilder {
if list == nil || list.items == nil {
b.items = nil
} else {
b.items = make([]*RolePolicyBindingBuilder, len(list.items))
for i, v := range list.items {
b.items[i] = NewRolePolicyBinding().Copy(v)
}
}
return b
}

// Build creates a list of 'role_policy_binding' objects using the
// configuration stored in the builder.
func (b *RolePolicyBindingListBuilder) Build() (list *RolePolicyBindingList, err error) {
items := make([]*RolePolicyBinding, len(b.items))
for i, item := range b.items {
items[i], err = item.Build()
if err != nil {
return
}
}
list = new(RolePolicyBindingList)
list.items = items
return
}
75 changes: 75 additions & 0 deletions clustersmgmt/v1/role_policy_binding_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"
)

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

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

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

// readRolePolicyBindingList reads list of values of the ”role_policy_binding' type from
// the given iterator.
func readRolePolicyBindingList(iterator *jsoniter.Iterator) []*RolePolicyBinding {
list := []*RolePolicyBinding{}
for iterator.ReadArray() {
item := readRolePolicyBinding(iterator)
list = append(list, item)
}
return list
}
71 changes: 71 additions & 0 deletions clustersmgmt/v1/role_policy_binding_status_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

// RolePolicyBindingStatusBuilder contains the data and logic needed to build 'role_policy_binding_status' objects.
type RolePolicyBindingStatusBuilder struct {
bitmap_ uint32
description string
value string
}

// NewRolePolicyBindingStatus creates a new builder of 'role_policy_binding_status' objects.
func NewRolePolicyBindingStatus() *RolePolicyBindingStatusBuilder {
return &RolePolicyBindingStatusBuilder{}
}

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

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

// Value sets the value of the 'value' attribute to the given value.
func (b *RolePolicyBindingStatusBuilder) Value(value string) *RolePolicyBindingStatusBuilder {
b.value = value
b.bitmap_ |= 2
return b
}

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

// Build creates a 'role_policy_binding_status' object using the configuration stored in the builder.
func (b *RolePolicyBindingStatusBuilder) Build() (object *RolePolicyBindingStatus, err error) {
object = new(RolePolicyBindingStatus)
object.bitmap_ = b.bitmap_
object.description = b.description
object.value = b.value
return
}
Loading

0 comments on commit 430f6c2

Please sign in to comment.