Skip to content

Commit 027fe8d

Browse files
committed
OCM-12069 | (feat): Add cluster migrations with examples
1 parent be9d26c commit 027fe8d

27 files changed

+25442
-21962
lines changed

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Hard tabs are required rather than spaces.
4040

4141
To use any updates to the [ocm-api-model](https://github.com/openshift-online/ocm-api-model), the version
4242
must be incremented for consumption in ocm-sdk-go generation. The version is defined by the latest git tag.
43-
The version is also defined in the ocm-api-model/CHANGES.md file.
43+
The version is also defined in the ocm-api-model/CHANGES.md file and version.go file.
4444

4545
Once all changes to the OCM API Model have been committed to the main branch, submit a separate change with
4646
an update to ocm-api-model/CHANGES.md. This update should indicate the version and describe the changes
@@ -53,7 +53,7 @@ included with the version update. The following is an example update to version
5353
- Add `config_managed` attribute to the `RoleBinding` type.
5454
```
5555

56-
Submit an MR with the CHANGES.md modification and review/merge.
56+
Submit an MR with the CHANGES.md and version.go modifications and review/merge.
5757

5858
Finally, create and submit a new tag with the new version following the below example:
5959

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export PATH := $(LOCAL_BIN_PATH):$(PATH)
2727
export CGO_ENABLED=0
2828

2929
# Details of the model to use:
30-
model_version:=v0.0.406
30+
model_version:=v0.0.407
3131
model_url:=https://github.com/openshift-online/ocm-api-model.git
3232

3333
# Details of the metamodel to use:

clustersmgmt/v1/cluster_client.go

+8
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,14 @@ func (c *ClusterClient) MetricQueries() *MetricQueriesClient {
351351
)
352352
}
353353

354+
// Migrations returns the target 'cluster_migrations' resource.
355+
func (c *ClusterClient) Migrations() *ClusterMigrationsClient {
356+
return NewClusterMigrationsClient(
357+
c.transport,
358+
path.Join(c.path, "migrations"),
359+
)
360+
}
361+
354362
// NodePools returns the target 'node_pools' resource.
355363
//
356364
// Reference to the resource that manages the collection of node pool resources.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
/*
2+
Copyright (c) 2020 Red Hat, Inc.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// IMPORTANT: This file has been generated automatically, refrain from modifying it manually as all
18+
// your changes will be lost when the file is generated again.
19+
20+
package v1 // github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1
21+
22+
import (
23+
time "time"
24+
)
25+
26+
// ClusterMigrationBuilder contains the data and logic needed to build 'cluster_migration' objects.
27+
//
28+
// Representation of a cluster migration.
29+
type ClusterMigrationBuilder struct {
30+
bitmap_ uint32
31+
id string
32+
href string
33+
clusterID string
34+
creationTimestamp time.Time
35+
sdnToOvn *SdnToOvnClusterMigrationBuilder
36+
state ClusterMigrationState
37+
type_ ClusterMigrationType
38+
updatedTimestamp time.Time
39+
}
40+
41+
// NewClusterMigration creates a new builder of 'cluster_migration' objects.
42+
func NewClusterMigration() *ClusterMigrationBuilder {
43+
return &ClusterMigrationBuilder{}
44+
}
45+
46+
// Link sets the flag that indicates if this is a link.
47+
func (b *ClusterMigrationBuilder) Link(value bool) *ClusterMigrationBuilder {
48+
b.bitmap_ |= 1
49+
return b
50+
}
51+
52+
// ID sets the identifier of the object.
53+
func (b *ClusterMigrationBuilder) ID(value string) *ClusterMigrationBuilder {
54+
b.id = value
55+
b.bitmap_ |= 2
56+
return b
57+
}
58+
59+
// HREF sets the link to the object.
60+
func (b *ClusterMigrationBuilder) HREF(value string) *ClusterMigrationBuilder {
61+
b.href = value
62+
b.bitmap_ |= 4
63+
return b
64+
}
65+
66+
// Empty returns true if the builder is empty, i.e. no attribute has a value.
67+
func (b *ClusterMigrationBuilder) Empty() bool {
68+
return b == nil || b.bitmap_&^1 == 0
69+
}
70+
71+
// ClusterID sets the value of the 'cluster_ID' attribute to the given value.
72+
func (b *ClusterMigrationBuilder) ClusterID(value string) *ClusterMigrationBuilder {
73+
b.clusterID = value
74+
b.bitmap_ |= 8
75+
return b
76+
}
77+
78+
// CreationTimestamp sets the value of the 'creation_timestamp' attribute to the given value.
79+
func (b *ClusterMigrationBuilder) CreationTimestamp(value time.Time) *ClusterMigrationBuilder {
80+
b.creationTimestamp = value
81+
b.bitmap_ |= 16
82+
return b
83+
}
84+
85+
// SdnToOvn sets the value of the 'sdn_to_ovn' attribute to the given value.
86+
//
87+
// Details for `SdnToOvn` cluster migrations.
88+
func (b *ClusterMigrationBuilder) SdnToOvn(value *SdnToOvnClusterMigrationBuilder) *ClusterMigrationBuilder {
89+
b.sdnToOvn = value
90+
if value != nil {
91+
b.bitmap_ |= 32
92+
} else {
93+
b.bitmap_ &^= 32
94+
}
95+
return b
96+
}
97+
98+
// State sets the value of the 'state' attribute to the given value.
99+
//
100+
// The state of the cluster migration.
101+
func (b *ClusterMigrationBuilder) State(value ClusterMigrationState) *ClusterMigrationBuilder {
102+
b.state = value
103+
b.bitmap_ |= 64
104+
return b
105+
}
106+
107+
// Type sets the value of the 'type' attribute to the given value.
108+
//
109+
// Type of cluster migration.
110+
func (b *ClusterMigrationBuilder) Type(value ClusterMigrationType) *ClusterMigrationBuilder {
111+
b.type_ = value
112+
b.bitmap_ |= 128
113+
return b
114+
}
115+
116+
// UpdatedTimestamp sets the value of the 'updated_timestamp' attribute to the given value.
117+
func (b *ClusterMigrationBuilder) UpdatedTimestamp(value time.Time) *ClusterMigrationBuilder {
118+
b.updatedTimestamp = value
119+
b.bitmap_ |= 256
120+
return b
121+
}
122+
123+
// Copy copies the attributes of the given object into this builder, discarding any previous values.
124+
func (b *ClusterMigrationBuilder) Copy(object *ClusterMigration) *ClusterMigrationBuilder {
125+
if object == nil {
126+
return b
127+
}
128+
b.bitmap_ = object.bitmap_
129+
b.id = object.id
130+
b.href = object.href
131+
b.clusterID = object.clusterID
132+
b.creationTimestamp = object.creationTimestamp
133+
if object.sdnToOvn != nil {
134+
b.sdnToOvn = NewSdnToOvnClusterMigration().Copy(object.sdnToOvn)
135+
} else {
136+
b.sdnToOvn = nil
137+
}
138+
b.state = object.state
139+
b.type_ = object.type_
140+
b.updatedTimestamp = object.updatedTimestamp
141+
return b
142+
}
143+
144+
// Build creates a 'cluster_migration' object using the configuration stored in the builder.
145+
func (b *ClusterMigrationBuilder) Build() (object *ClusterMigration, err error) {
146+
object = new(ClusterMigration)
147+
object.id = b.id
148+
object.href = b.href
149+
object.bitmap_ = b.bitmap_
150+
object.clusterID = b.clusterID
151+
object.creationTimestamp = b.creationTimestamp
152+
if b.sdnToOvn != nil {
153+
object.sdnToOvn, err = b.sdnToOvn.Build()
154+
if err != nil {
155+
return
156+
}
157+
}
158+
object.state = b.state
159+
object.type_ = b.type_
160+
object.updatedTimestamp = b.updatedTimestamp
161+
return
162+
}

0 commit comments

Comments
 (0)