|
| 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/accesstransparency/v1 |
| 21 | + |
| 22 | +// AccessProtectionBuilder contains the data and logic needed to build 'access_protection' objects. |
| 23 | +// |
| 24 | +// Representation of an access protection. |
| 25 | +type AccessProtectionBuilder struct { |
| 26 | + bitmap_ uint32 |
| 27 | + enabled bool |
| 28 | +} |
| 29 | + |
| 30 | +// NewAccessProtection creates a new builder of 'access_protection' objects. |
| 31 | +func NewAccessProtection() *AccessProtectionBuilder { |
| 32 | + return &AccessProtectionBuilder{} |
| 33 | +} |
| 34 | + |
| 35 | +// Empty returns true if the builder is empty, i.e. no attribute has a value. |
| 36 | +func (b *AccessProtectionBuilder) Empty() bool { |
| 37 | + return b == nil || b.bitmap_ == 0 |
| 38 | +} |
| 39 | + |
| 40 | +// Enabled sets the value of the 'enabled' attribute to the given value. |
| 41 | +func (b *AccessProtectionBuilder) Enabled(value bool) *AccessProtectionBuilder { |
| 42 | + b.enabled = value |
| 43 | + b.bitmap_ |= 1 |
| 44 | + return b |
| 45 | +} |
| 46 | + |
| 47 | +// Copy copies the attributes of the given object into this builder, discarding any previous values. |
| 48 | +func (b *AccessProtectionBuilder) Copy(object *AccessProtection) *AccessProtectionBuilder { |
| 49 | + if object == nil { |
| 50 | + return b |
| 51 | + } |
| 52 | + b.bitmap_ = object.bitmap_ |
| 53 | + b.enabled = object.enabled |
| 54 | + return b |
| 55 | +} |
| 56 | + |
| 57 | +// Build creates a 'access_protection' object using the configuration stored in the builder. |
| 58 | +func (b *AccessProtectionBuilder) Build() (object *AccessProtection, err error) { |
| 59 | + object = new(AccessProtection) |
| 60 | + object.bitmap_ = b.bitmap_ |
| 61 | + object.enabled = b.enabled |
| 62 | + return |
| 63 | +} |
0 commit comments