Skip to content

Commit

Permalink
add ec2MetadataHttpTokens to AWSNodePool
Browse files Browse the repository at this point in the history
Signed-off-by: marcolan018 <llan@redhat.com>
  • Loading branch information
marcolan018 committed Jun 28, 2024
1 parent 4be745c commit fff6aca
Show file tree
Hide file tree
Showing 6 changed files with 11,311 additions and 11,242 deletions.
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.378
model_version:=v0.0.379
model_url:=https://github.com/openshift-online/ocm-api-model.git

# Details of the metamodel to use:
Expand Down
24 changes: 18 additions & 6 deletions clustersmgmt/v1/aws_node_pool_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type AWSNodePoolBuilder struct {
href string
additionalSecurityGroupIds []string
availabilityZoneTypes map[string]string
ec2MetadataHttpTokens Ec2MetadataHttpTokens
instanceProfile string
instanceType string
subnetOutposts map[string]string
Expand Down Expand Up @@ -83,27 +84,36 @@ func (b *AWSNodePoolBuilder) AvailabilityZoneTypes(value map[string]string) *AWS
return b
}

// Ec2MetadataHttpTokens sets the value of the 'ec_2_metadata_http_tokens' attribute to the given value.
//
// Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances
func (b *AWSNodePoolBuilder) Ec2MetadataHttpTokens(value Ec2MetadataHttpTokens) *AWSNodePoolBuilder {
b.ec2MetadataHttpTokens = value
b.bitmap_ |= 32
return b
}

// InstanceProfile sets the value of the 'instance_profile' attribute to the given value.
func (b *AWSNodePoolBuilder) InstanceProfile(value string) *AWSNodePoolBuilder {
b.instanceProfile = value
b.bitmap_ |= 32
b.bitmap_ |= 64
return b
}

// InstanceType sets the value of the 'instance_type' attribute to the given value.
func (b *AWSNodePoolBuilder) InstanceType(value string) *AWSNodePoolBuilder {
b.instanceType = value
b.bitmap_ |= 64
b.bitmap_ |= 128
return b
}

// SubnetOutposts sets the value of the 'subnet_outposts' attribute to the given value.
func (b *AWSNodePoolBuilder) SubnetOutposts(value map[string]string) *AWSNodePoolBuilder {
b.subnetOutposts = value
if value != nil {
b.bitmap_ |= 128
b.bitmap_ |= 256
} else {
b.bitmap_ &^= 128
b.bitmap_ &^= 256
}
return b
}
Expand All @@ -112,9 +122,9 @@ func (b *AWSNodePoolBuilder) SubnetOutposts(value map[string]string) *AWSNodePoo
func (b *AWSNodePoolBuilder) Tags(value map[string]string) *AWSNodePoolBuilder {
b.tags = value
if value != nil {
b.bitmap_ |= 256
b.bitmap_ |= 512
} else {
b.bitmap_ &^= 256
b.bitmap_ &^= 512
}
return b
}
Expand All @@ -141,6 +151,7 @@ func (b *AWSNodePoolBuilder) Copy(object *AWSNodePool) *AWSNodePoolBuilder {
} else {
b.availabilityZoneTypes = nil
}
b.ec2MetadataHttpTokens = object.ec2MetadataHttpTokens
b.instanceProfile = object.instanceProfile
b.instanceType = object.instanceType
if len(object.subnetOutposts) > 0 {
Expand Down Expand Up @@ -178,6 +189,7 @@ func (b *AWSNodePoolBuilder) Build() (object *AWSNodePool, err error) {
object.availabilityZoneTypes[k] = v
}
}
object.ec2MetadataHttpTokens = b.ec2MetadataHttpTokens
object.instanceProfile = b.instanceProfile
object.instanceType = b.instanceType
if b.subnetOutposts != nil {
Expand Down
40 changes: 32 additions & 8 deletions clustersmgmt/v1/aws_node_pool_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type AWSNodePool struct {
href string
additionalSecurityGroupIds []string
availabilityZoneTypes map[string]string
ec2MetadataHttpTokens Ec2MetadataHttpTokens
instanceProfile string
instanceType string
subnetOutposts map[string]string
Expand Down Expand Up @@ -149,12 +150,35 @@ func (o *AWSNodePool) GetAvailabilityZoneTypes() (value map[string]string, ok bo
return
}

// Ec2MetadataHttpTokens returns the value of the 'ec_2_metadata_http_tokens' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
// Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances
func (o *AWSNodePool) Ec2MetadataHttpTokens() Ec2MetadataHttpTokens {
if o != nil && o.bitmap_&32 != 0 {
return o.ec2MetadataHttpTokens
}
return Ec2MetadataHttpTokens("")
}

// GetEc2MetadataHttpTokens returns the value of the 'ec_2_metadata_http_tokens' attribute and
// a flag indicating if the attribute has a value.
//
// Which Ec2MetadataHttpTokens to use for metadata service interaction options for EC2 instances
func (o *AWSNodePool) GetEc2MetadataHttpTokens() (value Ec2MetadataHttpTokens, ok bool) {
ok = o != nil && o.bitmap_&32 != 0
if ok {
value = o.ec2MetadataHttpTokens
}
return
}

// InstanceProfile returns the value of the 'instance_profile' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
// InstanceProfile is the AWS EC2 instance profile, which is a container for an IAM role that the EC2 instance uses.
func (o *AWSNodePool) InstanceProfile() string {
if o != nil && o.bitmap_&32 != 0 {
if o != nil && o.bitmap_&64 != 0 {
return o.instanceProfile
}
return ""
Expand All @@ -165,7 +189,7 @@ func (o *AWSNodePool) InstanceProfile() string {
//
// InstanceProfile is the AWS EC2 instance profile, which is a container for an IAM role that the EC2 instance uses.
func (o *AWSNodePool) GetInstanceProfile() (value string, ok bool) {
ok = o != nil && o.bitmap_&32 != 0
ok = o != nil && o.bitmap_&64 != 0
if ok {
value = o.instanceProfile
}
Expand All @@ -177,7 +201,7 @@ func (o *AWSNodePool) GetInstanceProfile() (value string, ok bool) {
//
// InstanceType is an ec2 instance type for node instances (e.g. m5.large).
func (o *AWSNodePool) InstanceType() string {
if o != nil && o.bitmap_&64 != 0 {
if o != nil && o.bitmap_&128 != 0 {
return o.instanceType
}
return ""
Expand All @@ -188,7 +212,7 @@ func (o *AWSNodePool) InstanceType() string {
//
// InstanceType is an ec2 instance type for node instances (e.g. m5.large).
func (o *AWSNodePool) GetInstanceType() (value string, ok bool) {
ok = o != nil && o.bitmap_&64 != 0
ok = o != nil && o.bitmap_&128 != 0
if ok {
value = o.instanceType
}
Expand All @@ -200,7 +224,7 @@ func (o *AWSNodePool) GetInstanceType() (value string, ok bool) {
//
// Associates nodepool subnets with AWS Outposts.
func (o *AWSNodePool) SubnetOutposts() map[string]string {
if o != nil && o.bitmap_&128 != 0 {
if o != nil && o.bitmap_&256 != 0 {
return o.subnetOutposts
}
return nil
Expand All @@ -211,7 +235,7 @@ func (o *AWSNodePool) SubnetOutposts() map[string]string {
//
// Associates nodepool subnets with AWS Outposts.
func (o *AWSNodePool) GetSubnetOutposts() (value map[string]string, ok bool) {
ok = o != nil && o.bitmap_&128 != 0
ok = o != nil && o.bitmap_&256 != 0
if ok {
value = o.subnetOutposts
}
Expand All @@ -230,7 +254,7 @@ func (o *AWSNodePool) GetSubnetOutposts() (value map[string]string, ok bool) {
// - Tag values may be between 0 and 256 characters in length
// - Tags may only contain letters, numbers, spaces, and the following characters: [_ . : / = + - @]
func (o *AWSNodePool) Tags() map[string]string {
if o != nil && o.bitmap_&256 != 0 {
if o != nil && o.bitmap_&512 != 0 {
return o.tags
}
return nil
Expand All @@ -248,7 +272,7 @@ func (o *AWSNodePool) Tags() map[string]string {
// - Tag values may be between 0 and 256 characters in length
// - Tags may only contain letters, numbers, spaces, and the following characters: [_ . : / = + - @]
func (o *AWSNodePool) GetTags() (value map[string]string, ok bool) {
ok = o != nil && o.bitmap_&256 != 0
ok = o != nil && o.bitmap_&512 != 0
if ok {
value = o.tags
}
Expand Down
28 changes: 21 additions & 7 deletions clustersmgmt/v1/aws_node_pool_type_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ func writeAWSNodePool(object *AWSNodePool, stream *jsoniter.Stream) {
count++
}
present_ = object.bitmap_&32 != 0
if present_ {
if count > 0 {
stream.WriteMore()
}
stream.WriteObjectField("ec2_metadata_http_tokens")
stream.WriteString(string(object.ec2MetadataHttpTokens))
count++
}
present_ = object.bitmap_&64 != 0
if present_ {
if count > 0 {
stream.WriteMore()
Expand All @@ -113,7 +122,7 @@ func writeAWSNodePool(object *AWSNodePool, stream *jsoniter.Stream) {
stream.WriteString(object.instanceProfile)
count++
}
present_ = object.bitmap_&64 != 0
present_ = object.bitmap_&128 != 0
if present_ {
if count > 0 {
stream.WriteMore()
Expand All @@ -122,7 +131,7 @@ func writeAWSNodePool(object *AWSNodePool, stream *jsoniter.Stream) {
stream.WriteString(object.instanceType)
count++
}
present_ = object.bitmap_&128 != 0 && object.subnetOutposts != nil
present_ = object.bitmap_&256 != 0 && object.subnetOutposts != nil
if present_ {
if count > 0 {
stream.WriteMore()
Expand Down Expand Up @@ -151,7 +160,7 @@ func writeAWSNodePool(object *AWSNodePool, stream *jsoniter.Stream) {
}
count++
}
present_ = object.bitmap_&256 != 0 && object.tags != nil
present_ = object.bitmap_&512 != 0 && object.tags != nil
if present_ {
if count > 0 {
stream.WriteMore()
Expand Down Expand Up @@ -230,14 +239,19 @@ func readAWSNodePool(iterator *jsoniter.Iterator) *AWSNodePool {
}
object.availabilityZoneTypes = value
object.bitmap_ |= 16
case "ec2_metadata_http_tokens":
text := iterator.ReadString()
value := Ec2MetadataHttpTokens(text)
object.ec2MetadataHttpTokens = value
object.bitmap_ |= 32
case "instance_profile":
value := iterator.ReadString()
object.instanceProfile = value
object.bitmap_ |= 32
object.bitmap_ |= 64
case "instance_type":
value := iterator.ReadString()
object.instanceType = value
object.bitmap_ |= 64
object.bitmap_ |= 128
case "subnet_outposts":
value := map[string]string{}
for {
Expand All @@ -249,7 +263,7 @@ func readAWSNodePool(iterator *jsoniter.Iterator) *AWSNodePool {
value[key] = item
}
object.subnetOutposts = value
object.bitmap_ |= 128
object.bitmap_ |= 256
case "tags":
value := map[string]string{}
for {
Expand All @@ -261,7 +275,7 @@ func readAWSNodePool(iterator *jsoniter.Iterator) *AWSNodePool {
value[key] = item
}
object.tags = value
object.bitmap_ |= 256
object.bitmap_ |= 512
default:
iterator.ReadAny()
}
Expand Down
Loading

0 comments on commit fff6aca

Please sign in to comment.