From fdb3473781d0704430fee95f2c09d2e91af920db Mon Sep 17 00:00:00 2001 From: Sharad Kesarwani <108344822+sharadkesarwani@users.noreply.github.com> Date: Mon, 18 Mar 2024 22:15:27 +0530 Subject: [PATCH] Added support for `healthCheckUnhealthyDurationBeforeReplacement` under launchSpecification. (#286) --- .../ocean/providers/aws/create/main.go | 1 + .../ocean/providers/aws/update/main.go | 3 ++ service/ocean/providers/aws/cluster.go | 42 +++++++++++-------- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/examples/service/ocean/providers/aws/create/main.go b/examples/service/ocean/providers/aws/create/main.go index 216c703e..4e893e22 100644 --- a/examples/service/ocean/providers/aws/create/main.go +++ b/examples/service/ocean/providers/aws/create/main.go @@ -76,6 +76,7 @@ func main() { ImageID: spotinst.String("ami-12345"), Monitoring: spotinst.Bool(false), SecurityGroupIDs: []string{"sg-foo"}, + HealthCheckUnhealthyDurationBeforeReplacement: spotinst.Int(180), BlockDeviceMappings: []*aws.ClusterBlockDeviceMappings{ &aws.ClusterBlockDeviceMappings{ DeviceName: spotinst.String("/dev/sdf"), diff --git a/examples/service/ocean/providers/aws/update/main.go b/examples/service/ocean/providers/aws/update/main.go index 707c25b3..73d8c431 100644 --- a/examples/service/ocean/providers/aws/update/main.go +++ b/examples/service/ocean/providers/aws/update/main.go @@ -41,6 +41,9 @@ func main() { Categories: []string{"General_purpose", "Compute_optimized"}, }, }, + LaunchSpecification: &aws.LaunchSpecification{ + HealthCheckUnhealthyDurationBeforeReplacement: spotinst.Int(60), + }, }, }, }) diff --git a/service/ocean/providers/aws/cluster.go b/service/ocean/providers/aws/cluster.go index 8f8d67ff..3e869ab3 100644 --- a/service/ocean/providers/aws/cluster.go +++ b/service/ocean/providers/aws/cluster.go @@ -201,23 +201,24 @@ type Filters struct { } type LaunchSpecification struct { - AssociatePublicIPAddress *bool `json:"associatePublicIpAddress,omitempty"` - AssociateIPv6Address *bool `json:"associateIpv6Address,omitempty"` - SecurityGroupIDs []string `json:"securityGroupIds,omitempty"` - ImageID *string `json:"imageId,omitempty"` - KeyPair *string `json:"keyPair,omitempty"` - UserData *string `json:"userData,omitempty"` - IAMInstanceProfile *IAMInstanceProfile `json:"iamInstanceProfile,omitempty"` - Tags []*Tag `json:"tags,omitempty"` - LoadBalancers []*LoadBalancer `json:"loadBalancers,omitempty"` - RootVolumeSize *int `json:"rootVolumeSize,omitempty"` - Monitoring *bool `json:"monitoring,omitempty"` - EBSOptimized *bool `json:"ebsOptimized,omitempty"` - UseAsTemplateOnly *bool `json:"useAsTemplateOnly,omitempty"` - InstanceMetadataOptions *InstanceMetadataOptions `json:"instanceMetadataOptions,omitempty"` - BlockDeviceMappings []*ClusterBlockDeviceMappings `json:"blockDeviceMappings,omitempty"` - LaunchSpecScheduling *LaunchSpecScheduling `json:"scheduling,omitempty"` - ResourceTagSpecification *ResourceTagSpecification `json:"resourceTagSpecification,omitempty"` + AssociatePublicIPAddress *bool `json:"associatePublicIpAddress,omitempty"` + AssociateIPv6Address *bool `json:"associateIpv6Address,omitempty"` + SecurityGroupIDs []string `json:"securityGroupIds,omitempty"` + ImageID *string `json:"imageId,omitempty"` + KeyPair *string `json:"keyPair,omitempty"` + UserData *string `json:"userData,omitempty"` + IAMInstanceProfile *IAMInstanceProfile `json:"iamInstanceProfile,omitempty"` + Tags []*Tag `json:"tags,omitempty"` + LoadBalancers []*LoadBalancer `json:"loadBalancers,omitempty"` + RootVolumeSize *int `json:"rootVolumeSize,omitempty"` + HealthCheckUnhealthyDurationBeforeReplacement *int `json:"healthCheckUnhealthyDurationBeforeReplacement,omitempty"` + Monitoring *bool `json:"monitoring,omitempty"` + EBSOptimized *bool `json:"ebsOptimized,omitempty"` + UseAsTemplateOnly *bool `json:"useAsTemplateOnly,omitempty"` + InstanceMetadataOptions *InstanceMetadataOptions `json:"instanceMetadataOptions,omitempty"` + BlockDeviceMappings []*ClusterBlockDeviceMappings `json:"blockDeviceMappings,omitempty"` + LaunchSpecScheduling *LaunchSpecScheduling `json:"scheduling,omitempty"` + ResourceTagSpecification *ResourceTagSpecification `json:"resourceTagSpecification,omitempty"` forceSendFields []string nullFields []string @@ -1683,6 +1684,13 @@ func (o *LaunchSpecification) SetResourceTagSpecification(v *ResourceTagSpecific return o } +func (o *LaunchSpecification) SetHealthCheckUnhealthyDurationBeforeReplacement(v *int) *LaunchSpecification { + if o.HealthCheckUnhealthyDurationBeforeReplacement = v; o.HealthCheckUnhealthyDurationBeforeReplacement == nil { + o.nullFields = append(o.nullFields, "HealthCheckUnhealthyDurationBeforeReplacement") + } + return o +} + // endregion // region LoadBalancer