Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCM-10883 | feat: bump api model to v0.0.393 #995

Merged
merged 3 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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.440
- Update model version v0.0.393
- Include missing field to hypershift model
- Include new fields to manifest model
- Remove v2alpha1 resources

## 0.1.439
- Update model version v0.0.392
- Add `vm` WIF access type
Expand Down
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.392
model_version:=v0.0.393
model_url:=https://github.com/openshift-online/ocm-api-model.git

# Details of the metamodel to use:
Expand Down
9 changes: 0 additions & 9 deletions clustersmgmt/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"path"

v1 "github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1"
"github.com/openshift-online/ocm-sdk-go/clustersmgmt/v2alpha1"
)

// Client is the client for service 'clusters_mgmt'.
Expand All @@ -49,11 +48,3 @@ func (c *Client) V1() *v1.Client {
path.Join(c.path, "v1"),
)
}

// V2alpha1 returns a reference to a client for version 'v2alpha1'.
func (c *Client) V2alpha1() *v2alpha1.Client {
return v2alpha1.NewClient(
c.transport,
path.Join(c.path, "v2alpha1"),
)
}
14 changes: 12 additions & 2 deletions clustersmgmt/v1/hypershift_config_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package v1 // github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1
// Hypershift configuration.
type HypershiftConfigBuilder struct {
bitmap_ uint32
hcpNamespace string
managementCluster string
enabled bool
}
Expand All @@ -38,17 +39,24 @@ func (b *HypershiftConfigBuilder) Empty() bool {
return b == nil || b.bitmap_ == 0
}

// HCPNamespace sets the value of the 'HCP_namespace' attribute to the given value.
func (b *HypershiftConfigBuilder) HCPNamespace(value string) *HypershiftConfigBuilder {
b.hcpNamespace = value
b.bitmap_ |= 1
return b
}

// Enabled sets the value of the 'enabled' attribute to the given value.
func (b *HypershiftConfigBuilder) Enabled(value bool) *HypershiftConfigBuilder {
b.enabled = value
b.bitmap_ |= 1
b.bitmap_ |= 2
return b
}

// ManagementCluster sets the value of the 'management_cluster' attribute to the given value.
func (b *HypershiftConfigBuilder) ManagementCluster(value string) *HypershiftConfigBuilder {
b.managementCluster = value
b.bitmap_ |= 2
b.bitmap_ |= 4
return b
}

Expand All @@ -58,6 +66,7 @@ func (b *HypershiftConfigBuilder) Copy(object *HypershiftConfig) *HypershiftConf
return b
}
b.bitmap_ = object.bitmap_
b.hcpNamespace = object.hcpNamespace
b.enabled = object.enabled
b.managementCluster = object.managementCluster
return b
Expand All @@ -67,6 +76,7 @@ func (b *HypershiftConfigBuilder) Copy(object *HypershiftConfig) *HypershiftConf
func (b *HypershiftConfigBuilder) Build() (object *HypershiftConfig, err error) {
object = new(HypershiftConfig)
object.bitmap_ = b.bitmap_
object.hcpNamespace = b.hcpNamespace
object.enabled = b.enabled
object.managementCluster = b.managementCluster
return
Expand Down
34 changes: 30 additions & 4 deletions clustersmgmt/v1/hypershift_config_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package v1 // github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1
// Hypershift configuration.
type HypershiftConfig struct {
bitmap_ uint32
hcpNamespace string
managementCluster string
enabled bool
}
Expand All @@ -33,6 +34,31 @@ func (o *HypershiftConfig) Empty() bool {
return o == nil || o.bitmap_ == 0
}

// HCPNamespace returns the value of the 'HCP_namespace' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
// Contains the name of the hcp namespace for this Hypershift cluster.
// Empty for non Hypershift clusters.
func (o *HypershiftConfig) HCPNamespace() string {
if o != nil && o.bitmap_&1 != 0 {
return o.hcpNamespace
}
return ""
}

// GetHCPNamespace returns the value of the 'HCP_namespace' attribute and
// a flag indicating if the attribute has a value.
//
// Contains the name of the hcp namespace for this Hypershift cluster.
// Empty for non Hypershift clusters.
func (o *HypershiftConfig) GetHCPNamespace() (value string, ok bool) {
ok = o != nil && o.bitmap_&1 != 0
if ok {
value = o.hcpNamespace
}
return
}

// Enabled returns the value of the 'enabled' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
Expand All @@ -43,7 +69,7 @@ func (o *HypershiftConfig) Empty() bool {
// To enable it the cluster needs to be ROSA cluster and the organization of the user needs
// to have the `hypershift` capability enabled.
func (o *HypershiftConfig) Enabled() bool {
if o != nil && o.bitmap_&1 != 0 {
if o != nil && o.bitmap_&2 != 0 {
return o.enabled
}
return false
Expand All @@ -59,7 +85,7 @@ func (o *HypershiftConfig) Enabled() bool {
// To enable it the cluster needs to be ROSA cluster and the organization of the user needs
// to have the `hypershift` capability enabled.
func (o *HypershiftConfig) GetEnabled() (value bool, ok bool) {
ok = o != nil && o.bitmap_&1 != 0
ok = o != nil && o.bitmap_&2 != 0
if ok {
value = o.enabled
}
Expand All @@ -72,7 +98,7 @@ func (o *HypershiftConfig) GetEnabled() (value bool, ok bool) {
// Contains the name of the current management cluster for this Hypershift cluster.
// Empty for non Hypershift clusters.
func (o *HypershiftConfig) ManagementCluster() string {
if o != nil && o.bitmap_&2 != 0 {
if o != nil && o.bitmap_&4 != 0 {
return o.managementCluster
}
return ""
Expand All @@ -84,7 +110,7 @@ func (o *HypershiftConfig) ManagementCluster() string {
// Contains the name of the current management cluster for this Hypershift cluster.
// Empty for non Hypershift clusters.
func (o *HypershiftConfig) GetManagementCluster() (value string, ok bool) {
ok = o != nil && o.bitmap_&2 != 0
ok = o != nil && o.bitmap_&4 != 0
if ok {
value = o.managementCluster
}
Expand Down
19 changes: 16 additions & 3 deletions clustersmgmt/v1/hypershift_config_type_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ func writeHypershiftConfig(object *HypershiftConfig, stream *jsoniter.Stream) {
stream.WriteObjectStart()
var present_ bool
present_ = object.bitmap_&1 != 0
if present_ {
if count > 0 {
stream.WriteMore()
}
stream.WriteObjectField("hcp_namespace")
stream.WriteString(object.hcpNamespace)
count++
}
present_ = object.bitmap_&2 != 0
if present_ {
if count > 0 {
stream.WriteMore()
Expand All @@ -51,7 +60,7 @@ func writeHypershiftConfig(object *HypershiftConfig, stream *jsoniter.Stream) {
stream.WriteBool(object.enabled)
count++
}
present_ = object.bitmap_&2 != 0
present_ = object.bitmap_&4 != 0
if present_ {
if count > 0 {
stream.WriteMore()
Expand Down Expand Up @@ -83,14 +92,18 @@ func readHypershiftConfig(iterator *jsoniter.Iterator) *HypershiftConfig {
break
}
switch field {
case "hcp_namespace":
value := iterator.ReadString()
object.hcpNamespace = value
object.bitmap_ |= 1
case "enabled":
value := iterator.ReadBool()
object.enabled = value
object.bitmap_ |= 1
object.bitmap_ |= 2
case "management_cluster":
value := iterator.ReadString()
object.managementCluster = value
object.bitmap_ |= 2
object.bitmap_ |= 4
default:
iterator.ReadAny()
}
Expand Down
54 changes: 49 additions & 5 deletions clustersmgmt/v1/manifest_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,22 @@ limitations under the License.

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

import (
time "time"
)

// ManifestBuilder contains the data and logic needed to build 'manifest' objects.
//
// Representation of a manifestwork.
type ManifestBuilder struct {
bitmap_ uint32
id string
href string
workloads []interface{}
bitmap_ uint32
id string
href string
creationTimestamp time.Time
liveResource interface{}
spec interface{}
updatedTimestamp time.Time
workloads []interface{}
}

// NewManifest creates a new builder of 'manifest' objects.
Expand Down Expand Up @@ -59,11 +67,39 @@ func (b *ManifestBuilder) Empty() bool {
return b == nil || b.bitmap_&^1 == 0
}

// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value.
func (b *ManifestBuilder) CreationTimestamp(value time.Time) *ManifestBuilder {
b.creationTimestamp = value
b.bitmap_ |= 8
return b
}

// LiveResource sets the value of the 'live_resource' attribute to the given value.
func (b *ManifestBuilder) LiveResource(value interface{}) *ManifestBuilder {
b.liveResource = value
b.bitmap_ |= 16
return b
}

// Spec sets the value of the 'spec' attribute to the given value.
func (b *ManifestBuilder) Spec(value interface{}) *ManifestBuilder {
b.spec = value
b.bitmap_ |= 32
return b
}

// UpdatedTimestamp sets the value of the 'updated_timestamp' attribute to the given value.
func (b *ManifestBuilder) UpdatedTimestamp(value time.Time) *ManifestBuilder {
b.updatedTimestamp = value
b.bitmap_ |= 64
return b
}

// Workloads sets the value of the 'workloads' attribute to the given values.
func (b *ManifestBuilder) Workloads(values ...interface{}) *ManifestBuilder {
b.workloads = make([]interface{}, len(values))
copy(b.workloads, values)
b.bitmap_ |= 8
b.bitmap_ |= 128
return b
}

Expand All @@ -75,6 +111,10 @@ func (b *ManifestBuilder) Copy(object *Manifest) *ManifestBuilder {
b.bitmap_ = object.bitmap_
b.id = object.id
b.href = object.href
b.creationTimestamp = object.creationTimestamp
b.liveResource = object.liveResource
b.spec = object.spec
b.updatedTimestamp = object.updatedTimestamp
if object.workloads != nil {
b.workloads = make([]interface{}, len(object.workloads))
copy(b.workloads, object.workloads)
Expand All @@ -90,6 +130,10 @@ func (b *ManifestBuilder) Build() (object *Manifest, err error) {
object.id = b.id
object.href = b.href
object.bitmap_ = b.bitmap_
object.creationTimestamp = b.creationTimestamp
object.liveResource = b.liveResource
object.spec = b.spec
object.updatedTimestamp = b.updatedTimestamp
if b.workloads != nil {
object.workloads = make([]interface{}, len(b.workloads))
copy(object.workloads, b.workloads)
Expand Down
Loading
Loading