Skip to content

Commit

Permalink
Merge pull request #645 from vkareh/release_0.1.269
Browse files Browse the repository at this point in the history
Release 0.1.269
  • Loading branch information
vkareh authored May 26, 2022
2 parents 6359491 + c066ecf commit 5603f5e
Show file tree
Hide file tree
Showing 8 changed files with 1,343 additions and 1,259 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
This document describes the relevant changes between releases of the OCM API
SDK.

## 0.1.269

- authentication: Allow client credential grants with basic auth
- Update to model 0.0.201:
- Adding groups claim to openID IDP

## 0.1.268

- Update to model 0.0.200:
Expand Down
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.200
model_version:=v0.0.201
model_url:=https://github.com/openshift-online/ocm-api-model.git

# Details of the metamodel to use:
Expand Down
25 changes: 23 additions & 2 deletions clustersmgmt/v1/open_id_claims_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ package v1 // github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1
type OpenIDClaimsBuilder struct {
bitmap_ uint32
email []string
groups []string
name []string
preferredUsername []string
}
Expand All @@ -49,13 +50,23 @@ func (b *OpenIDClaimsBuilder) Email(values ...string) *OpenIDClaimsBuilder {
return b
}

// Groups sets the value of the 'groups' attribute to the given values.
//
//
func (b *OpenIDClaimsBuilder) Groups(values ...string) *OpenIDClaimsBuilder {
b.groups = make([]string, len(values))
copy(b.groups, values)
b.bitmap_ |= 2
return b
}

// Name sets the value of the 'name' attribute to the given values.
//
//
func (b *OpenIDClaimsBuilder) Name(values ...string) *OpenIDClaimsBuilder {
b.name = make([]string, len(values))
copy(b.name, values)
b.bitmap_ |= 2
b.bitmap_ |= 4
return b
}

Expand All @@ -65,7 +76,7 @@ func (b *OpenIDClaimsBuilder) Name(values ...string) *OpenIDClaimsBuilder {
func (b *OpenIDClaimsBuilder) PreferredUsername(values ...string) *OpenIDClaimsBuilder {
b.preferredUsername = make([]string, len(values))
copy(b.preferredUsername, values)
b.bitmap_ |= 4
b.bitmap_ |= 8
return b
}

Expand All @@ -81,6 +92,12 @@ func (b *OpenIDClaimsBuilder) Copy(object *OpenIDClaims) *OpenIDClaimsBuilder {
} else {
b.email = nil
}
if object.groups != nil {
b.groups = make([]string, len(object.groups))
copy(b.groups, object.groups)
} else {
b.groups = nil
}
if object.name != nil {
b.name = make([]string, len(object.name))
copy(b.name, object.name)
Expand All @@ -104,6 +121,10 @@ func (b *OpenIDClaimsBuilder) Build() (object *OpenIDClaims, err error) {
object.email = make([]string, len(b.email))
copy(object.email, b.email)
}
if b.groups != nil {
object.groups = make([]string, len(b.groups))
copy(object.groups, b.groups)
}
if b.name != nil {
object.name = make([]string, len(b.name))
copy(object.name, b.name)
Expand Down
32 changes: 28 additions & 4 deletions clustersmgmt/v1/open_id_claims_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ package v1 // github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1
type OpenIDClaims struct {
bitmap_ uint32
email []string
groups []string
name []string
preferredUsername []string
}
Expand Down Expand Up @@ -57,12 +58,35 @@ func (o *OpenIDClaims) GetEmail() (value []string, ok bool) {
return
}

// Groups returns the value of the 'groups' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
// List of claims to use as the group name.
func (o *OpenIDClaims) Groups() []string {
if o != nil && o.bitmap_&2 != 0 {
return o.groups
}
return nil
}

// GetGroups returns the value of the 'groups' attribute and
// a flag indicating if the attribute has a value.
//
// List of claims to use as the group name.
func (o *OpenIDClaims) GetGroups() (value []string, ok bool) {
ok = o != nil && o.bitmap_&2 != 0
if ok {
value = o.groups
}
return
}

// Name returns the value of the 'name' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
// List of claims to use as the display name.
func (o *OpenIDClaims) Name() []string {
if o != nil && o.bitmap_&2 != 0 {
if o != nil && o.bitmap_&4 != 0 {
return o.name
}
return nil
Expand All @@ -73,7 +97,7 @@ func (o *OpenIDClaims) Name() []string {
//
// List of claims to use as the display name.
func (o *OpenIDClaims) GetName() (value []string, ok bool) {
ok = o != nil && o.bitmap_&2 != 0
ok = o != nil && o.bitmap_&4 != 0
if ok {
value = o.name
}
Expand All @@ -85,7 +109,7 @@ func (o *OpenIDClaims) GetName() (value []string, ok bool) {
//
// List of claims to use as the preferred user name when provisioning a user.
func (o *OpenIDClaims) PreferredUsername() []string {
if o != nil && o.bitmap_&4 != 0 {
if o != nil && o.bitmap_&8 != 0 {
return o.preferredUsername
}
return nil
Expand All @@ -96,7 +120,7 @@ func (o *OpenIDClaims) PreferredUsername() []string {
//
// List of claims to use as the preferred user name when provisioning a user.
func (o *OpenIDClaims) GetPreferredUsername() (value []string, ok bool) {
ok = o != nil && o.bitmap_&4 != 0
ok = o != nil && o.bitmap_&8 != 0
if ok {
value = o.preferredUsername
}
Expand Down
21 changes: 17 additions & 4 deletions clustersmgmt/v1/open_id_claims_type_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,16 @@ func writeOpenIDClaims(object *OpenIDClaims, stream *jsoniter.Stream) {
writeStringList(object.email, stream)
count++
}
present_ = object.bitmap_&2 != 0 && object.name != nil
present_ = object.bitmap_&2 != 0 && object.groups != nil
if present_ {
if count > 0 {
stream.WriteMore()
}
stream.WriteObjectField("groups")
writeStringList(object.groups, stream)
count++
}
present_ = object.bitmap_&4 != 0 && object.name != nil
if present_ {
if count > 0 {
stream.WriteMore()
Expand All @@ -60,7 +69,7 @@ func writeOpenIDClaims(object *OpenIDClaims, stream *jsoniter.Stream) {
writeStringList(object.name, stream)
count++
}
present_ = object.bitmap_&4 != 0 && object.preferredUsername != nil
present_ = object.bitmap_&8 != 0 && object.preferredUsername != nil
if present_ {
if count > 0 {
stream.WriteMore()
Expand Down Expand Up @@ -96,14 +105,18 @@ func readOpenIDClaims(iterator *jsoniter.Iterator) *OpenIDClaims {
value := readStringList(iterator)
object.email = value
object.bitmap_ |= 1
case "groups":
value := readStringList(iterator)
object.groups = value
object.bitmap_ |= 2
case "name":
value := readStringList(iterator)
object.name = value
object.bitmap_ |= 2
object.bitmap_ |= 4
case "preferred_username":
value := readStringList(iterator)
object.preferredUsername = value
object.bitmap_ |= 4
object.bitmap_ |= 8
default:
iterator.ReadAny()
}
Expand Down
Loading

0 comments on commit 5603f5e

Please sign in to comment.