|
| 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