From fc46a44b7fc731281eb26336d906d2f1033bfa53 Mon Sep 17 00:00:00 2001 From: yehielnetapp Date: Mon, 4 Nov 2024 08:58:24 +0200 Subject: [PATCH 1/4] first commit update doc --- docs/getting_started/spot-ocean.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/getting_started/spot-ocean.md b/docs/getting_started/spot-ocean.md index c507454980..dd0834c39c 100644 --- a/docs/getting_started/spot-ocean.md +++ b/docs/getting_started/spot-ocean.md @@ -204,12 +204,14 @@ metadata: ``` -| Label | Description | Default | -|-----------------------------------------------------------------|----------------------------------------------------------------------------------------|---| -| `spotinst.io/strategy-cluster-spread-nodes-by` | Specify how Ocean will spread the nodes across markets by this value [vcpu,count]. | `count` | -| `spotinst.io/strategy-cluster-orientation-availability-vs-cost` | Specify approach [cost,balanced,cheapest] that Ocean takes while launching nodes. | `balanced` | -| `spotinst.io/resource-tag-specification-volumes` | Specify if Volume resources will be tagged with Virtual Node Group tags or Ocean tags. | `false` | +| Label | Description | Default | +|---|----------------------------------------------------------------------------------------|---| +| `spotinst.io/strategy-cluster-spread-nodes-by` | Specify how Ocean will spread the nodes across markets by this value [vcpu,count]. | `count` | +| `spotinst.io/strategy-cluster-orientation-availability-vs-cost` | Specify approach [cost,balanced,cheapest] that Ocean takes while launching nodes. | `balanced` | +| `spotinst.io/resource-tag-specification-volumes` | Specify if Volume resources will be tagged with Virtual Node Group tags or Ocean tags. | `false` | +| `spotinst.io/autoscaler-aggressive-scale-down` | Specify if nodes to be promptly scaled down without any waiting period. | `false` | +>>>>>>> 5b5132332a (first commit update doc) ## Documentation If you're new to [Spot](https://spot.io/) and want to get started, please checkout our [Getting Started](https://docs.spot.io/connect-your-cloud-provider/) guide, available on the [Spot Documentation](https://docs.spot.io/) website. From f513aea9572a4063145135f45385582621232323 Mon Sep 17 00:00:00 2001 From: yehielnetapp Date: Mon, 4 Nov 2024 09:57:38 +0200 Subject: [PATCH 2/4] try 2 change doc --- docs/getting_started/spot-ocean.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting_started/spot-ocean.md b/docs/getting_started/spot-ocean.md index dd0834c39c..1bf38e998d 100644 --- a/docs/getting_started/spot-ocean.md +++ b/docs/getting_started/spot-ocean.md @@ -211,7 +211,7 @@ metadata: | `spotinst.io/strategy-cluster-orientation-availability-vs-cost` | Specify approach [cost,balanced,cheapest] that Ocean takes while launching nodes. | `balanced` | | `spotinst.io/resource-tag-specification-volumes` | Specify if Volume resources will be tagged with Virtual Node Group tags or Ocean tags. | `false` | | `spotinst.io/autoscaler-aggressive-scale-down` | Specify if nodes to be promptly scaled down without any waiting period. | `false` | ->>>>>>> 5b5132332a (first commit update doc) + ## Documentation If you're new to [Spot](https://spot.io/) and want to get started, please checkout our [Getting Started](https://docs.spot.io/connect-your-cloud-provider/) guide, available on the [Spot Documentation](https://docs.spot.io/) website. From 9e06e9753fe403ba35994cee11cdc7c5f0fd3997 Mon Sep 17 00:00:00 2001 From: yehielnetapp Date: Mon, 4 Nov 2024 10:05:21 +0200 Subject: [PATCH 3/4] update to github.com/spotinst/spotinst-sdk-go v1.372.0 ,run make gomod --- go.mod | 2 +- go.sum | 4 +- .../service/elastigroup/elastigroup.go | 8 - .../service/elastigroup/providers/aws/aws.go | 352 ++- .../elastigroup/providers/aws/service.go | 1 + .../elastigroup/providers/azure/azure.go | 2494 ----------------- .../elastigroup/providers/azure/service.go | 51 - .../elastigroup/providers/azure/tag.go | 31 - .../elastigroup/providers/azure/v3/azure.go | 1273 ++++++++- .../service/elastigroup/providers/gcp/gcp.go | 46 +- .../spotinst-sdk-go/service/ocean/ocean.go | 16 +- .../service/ocean/providers/aws/cluster.go | 286 +- .../ocean/providers/aws/clusternodes.go | 123 + .../service/ocean/providers/aws/launchspec.go | 232 +- .../ocean/providers/aws/launchspec_ecs.go | 28 + .../ocean/providers/aws/loadbalancer.go | 73 + .../ocean/providers/aws/migrationstatus.go | 136 + .../ocean/providers/aws/migrationsummary.go | 97 + .../ocean/providers/aws/rightsizing.go | 12 +- .../service/ocean/providers/aws/service.go | 9 +- .../service/ocean/providers/azure/cluster.go | 1275 --------- .../service/ocean/providers/azure/common.go | 147 - .../ocean/providers/azure/nodegroup.go | 446 --- .../ocean/providers/azure/rightsizing.go | 134 - .../service/ocean/providers/azure/service.go | 44 - .../ocean/providers/azure_np/cluster_np.go | 268 +- .../ocean/providers/azure_np/common.go | 297 +- .../ocean/providers/azure_np/service.go | 5 + .../service/ocean/providers/gcp/cluster.go | 14 +- .../service/ocean/providers/gcp/launchspec.go | 8 +- .../ocean/right_sizing/right_sizing.go | 675 +++++ .../service/ocean/right_sizing/service.go | 38 + .../spotinst-sdk-go/spotinst/client/client.go | 12 + .../spotinst/client/request.go | 43 + .../spotinst-sdk-go/spotinst/version.go | 2 +- vendor/modules.txt | 7 +- 36 files changed, 3888 insertions(+), 4801 deletions(-) delete mode 100644 vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/azure.go delete mode 100644 vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/service.go delete mode 100644 vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/tag.go create mode 100644 vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/clusternodes.go create mode 100644 vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/loadbalancer.go create mode 100644 vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/migrationstatus.go create mode 100644 vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/migrationsummary.go delete mode 100644 vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/cluster.go delete mode 100644 vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/common.go delete mode 100644 vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/nodegroup.go delete mode 100644 vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/rightsizing.go delete mode 100644 vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/service.go create mode 100644 vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/right_sizing/right_sizing.go create mode 100644 vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/right_sizing/service.go diff --git a/go.mod b/go.mod index 8889c5821f..8a8c88c962 100644 --- a/go.mod +++ b/go.mod @@ -58,7 +58,7 @@ require ( github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.19.0 - github.com/spotinst/spotinst-sdk-go v1.171.0 + github.com/spotinst/spotinst-sdk-go v1.372.0 github.com/stretchr/testify v1.9.0 github.com/weaveworks/mesh v0.0.0-20191105120815-58dbcc3e8e63 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 diff --git a/go.sum b/go.sum index 4f4db242e1..08157c8c67 100644 --- a/go.sum +++ b/go.sum @@ -627,8 +627,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= -github.com/spotinst/spotinst-sdk-go v1.171.0 h1:ZihMPEjkpIkSpawWLJt9RtCRY4mOQMGlfrkVmA03000= -github.com/spotinst/spotinst-sdk-go v1.171.0/go.mod h1:Ku9c4p+kRWnQqmXkzGcTMHLcQKgLHrQZISxeKY7mPqE= +github.com/spotinst/spotinst-sdk-go v1.372.0 h1:B4/+HK3D2Fe0821DOmw5RO4Lrzo2gi7oa6QWWjr5/7A= +github.com/spotinst/spotinst-sdk-go v1.372.0/go.mod h1:Tn4/eb0SFY6IXmxz71CClujvbD/PuT+EO6Ta8v6AML4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/elastigroup.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/elastigroup.go index d653e33c0c..d591dcfcaa 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/elastigroup.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/elastigroup.go @@ -2,7 +2,6 @@ package elastigroup import ( "github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/aws" - "github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure" azurev3 "github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/v3" "github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/gcp" "github.com/spotinst/spotinst-sdk-go/spotinst" @@ -15,7 +14,6 @@ import ( // the service. type Service interface { CloudProviderAWS() aws.Service - CloudProviderAzure() azure.Service CloudProviderAzureV3() azurev3.Service CloudProviderGCP() gcp.Service } @@ -42,12 +40,6 @@ func (s *ServiceOp) CloudProviderAWS() aws.Service { } } -func (s *ServiceOp) CloudProviderAzure() azure.Service { - return &azure.ServiceOp{ - Client: s.Client, - } -} - func (s *ServiceOp) CloudProviderAzureV3() azurev3.Service { return &azurev3.ServiceOp{ Client: s.Client, diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/aws/aws.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/aws/aws.go index b813c65be2..c600796d0d 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/aws/aws.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/aws/aws.go @@ -70,6 +70,7 @@ type Group struct { Scaling *Scaling `json:"scaling,omitempty"` Scheduling *Scheduling `json:"scheduling,omitempty"` Integration *Integration `json:"thirdPartiesIntegration,omitempty"` + Logging *Logging `json:"logging,omitempty"` // Read-only fields. CreatedAt *time.Time `json:"createdAt,omitempty"` @@ -100,7 +101,6 @@ type Integration struct { Rancher *RancherIntegration `json:"rancher,omitempty"` Kubernetes *KubernetesIntegration `json:"kubernetes,omitempty"` Mesosphere *MesosphereIntegration `json:"mesosphere,omitempty"` - Multai *MultaiIntegration `json:"mlbRuntime,omitempty"` Nomad *NomadIntegration `json:"nomad,omitempty"` Chef *ChefIntegration `json:"chef,omitempty"` Gitlab *GitlabIntegration `json:"gitlab,omitempty"` @@ -317,13 +317,6 @@ type MesosphereIntegration struct { nullFields []string } -type MultaiIntegration struct { - DeploymentID *string `json:"deploymentId,omitempty"` - - forceSendFields []string - nullFields []string -} - type NomadIntegration struct { MasterHost *string `json:"masterHost,omitempty"` MasterPort *int `json:"masterPort,omitempty"` @@ -541,6 +534,7 @@ type Strategy struct { MinimumInstanceLifetime *int `json:"minimumInstanceLifetime,omitempty"` ConsiderODPricing *bool `json:"considerODPricing,omitempty"` ImmediateODRecoverThreshold *int `json:"immediateODRecoverThreshold,omitempty"` + RestrictSingleAz *bool `json:"restrictSingleAz,omitempty"` forceSendFields []string nullFields []string @@ -702,6 +696,7 @@ type LaunchSpecification struct { CPUOptions *CPUOptions `json:"cpuOptions,omitempty"` ResourceTagSpecification *ResourceTagSpecification `json:"resourceTagSpecification,omitempty"` ITF *ITF `json:"itf,omitempty"` + AutoHealing *bool `json:"autoHealing,omitempty"` forceSendFields []string nullFields []string @@ -839,13 +834,9 @@ type LoadBalancersConfig struct { } type LoadBalancer struct { - Name *string `json:"name,omitempty"` - Arn *string `json:"arn,omitempty"` - Type *string `json:"type,omitempty"` - BalancerID *string `json:"balancerId,omitempty"` - TargetSetID *string `json:"targetSetId,omitempty"` - ZoneAwareness *bool `json:"azAwareness,omitempty"` - AutoWeight *bool `json:"autoWeight,omitempty"` + Name *string `json:"name,omitempty"` + Arn *string `json:"arn,omitempty"` + Type *string `json:"type,omitempty"` forceSendFields []string nullFields []string @@ -877,14 +868,34 @@ type BlockDeviceMapping struct { } type EBS struct { - DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` - Encrypted *bool `json:"encrypted,omitempty"` - KmsKeyId *string `json:"kmsKeyId,omitempty"` - SnapshotID *string `json:"snapshotId,omitempty"` - VolumeType *string `json:"volumeType,omitempty"` - VolumeSize *int `json:"volumeSize,omitempty"` - IOPS *int `json:"iops,omitempty"` - Throughput *int `json:"throughput,omitempty"` + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + Encrypted *bool `json:"encrypted,omitempty"` + KmsKeyId *string `json:"kmsKeyId,omitempty"` + SnapshotID *string `json:"snapshotId,omitempty"` + VolumeType *string `json:"volumeType,omitempty"` + VolumeSize *int `json:"volumeSize,omitempty"` + IOPS *int `json:"iops,omitempty"` + Throughput *int `json:"throughput,omitempty"` + DynamicIOPS *DynamicIOPS `json:"dynamicIops,omitempty"` + DynamicVolumeSize *DynamicVolumeSize `json:"dynamicVolumeSize,omitempty"` + + forceSendFields []string + nullFields []string +} + +type DynamicIOPS struct { + BaseSize *int `json:"baseSize,omitempty"` + Resource *string `json:"resource,omitempty"` + SizePerResourceUnit *int `json:"sizePerResourceUnit,omitempty"` + + forceSendFields []string + nullFields []string +} + +type DynamicVolumeSize struct { + BaseSize *int `json:"baseSize,omitempty"` + Resource *string `json:"resource,omitempty"` + SizePerResourceUnit *int `json:"sizePerResourceUnit,omitempty"` forceSendFields []string nullFields []string @@ -1105,6 +1116,33 @@ type DeploymentStatusInput struct { RollID *string `json:"id,omitempty"` } +type RollStatusInput struct { + GroupID *string `json:"groupId,omitempty"` + RollID *string `json:"id,omitempty"` +} + +type BGInstance struct { + InstanceID *string `json:"instanceId,omitempty"` + Lifecycle *string `json:"lifeCycle,omitempty"` + BatchNum *int `json:"batchNum,omitempty"` + Status *string `json:"status,omitempty"` +} + +type BGInstances struct { + Blue []*BGInstance `json:"blue,omitempty"` + Green []*BGInstance `json:"green,omitempty"` +} + +type RollStatusOutput struct { + Progress *Progress `json:"progress,omitempty"` + NumberOfBatches *int `json:"numberOfBatches,omitempty"` + CurrentBatch *int `json:"currentBatch,omitempty"` + GracePeriod *int `json:"gracePeriod,omitempty"` + StrategyAction *string `json:"strategyAction,omitempty"` + HealthCheck *string `json:"healthCheck,omitempty"` + Instances []*BGInstances `json:"instances,omitempty"` +} + type Roll struct { Status *string `json:"status,omitempty"` } @@ -1188,6 +1226,25 @@ type DeallocateStatefulInstanceInput struct { type DeallocateStatefulInstanceOutput struct{} +type Logging struct { + Export *Export `json:"export,omitempty"` + + forceSendFields []string + nullFields []string +} +type Export struct { + S3 *S3 `json:"s3,omitempty"` + + forceSendFields []string + nullFields []string +} +type S3 struct { + Id *string `json:"id,omitempty"` + + forceSendFields []string + nullFields []string +} + func deploymentStatusFromJSON(in []byte) (*RollGroupStatus, error) { b := new(RollGroupStatus) if err := json.Unmarshal(in, b); err != nil { @@ -1214,7 +1271,6 @@ func deploymentStatusesFromJSON(in []byte) ([]*RollGroupStatus, error) { } return out, nil } - func deploymentStatusFromHttpResponse(resp *http.Response) ([]*RollGroupStatus, error) { body, err := ioutil.ReadAll(resp.Body) if err != nil { @@ -1223,6 +1279,38 @@ func deploymentStatusFromHttpResponse(resp *http.Response) ([]*RollGroupStatus, return deploymentStatusesFromJSON(body) } +func rollStatusOutputFromJSON(in []byte) (*RollStatusOutput, error) { + b := new(RollStatusOutput) + if err := json.Unmarshal(in, b); err != nil { + return nil, err + } + return b, nil +} + +func rollStatusFromJSON(in []byte) (*RollStatusOutput, error) { + var rw client.Response + if err := json.Unmarshal(in, &rw); err != nil { + return nil, err + } + if len(rw.Response.Items) == 0 { + return nil, nil + } + // Only 1 roll allowed at a time + rollStatusOutput, err := rollStatusOutputFromJSON(rw.Response.Items[0]) + if err != nil { + return nil, err + } + return rollStatusOutput, nil +} + +func rollStatusFromHttpResponse(resp *http.Response) (*RollStatusOutput, error) { + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + return rollStatusFromJSON(body) +} + func groupFromJSON(in []byte) (*Group, error) { b := new(Group) if err := json.Unmarshal(in, b); err != nil { @@ -1685,6 +1773,31 @@ func (s *ServiceOp) Roll(ctx context.Context, input *RollGroupInput) (*RollGroup return &RollGroupOutput{deployments}, nil } +func (s *ServiceOp) RollStatus(ctx context.Context, input *RollStatusInput) (*RollStatusOutput, error) { + path, err := uritemplates.Expand("/aws/ec2/group/{groupId}/roll/{rollId}/status", uritemplates.Values{ + "groupId": spotinst.StringValue(input.GroupID), + "rollId": spotinst.StringValue(input.RollID), + }) + if err != nil { + return nil, err + } + + r := client.NewRequest(http.MethodGet, path) + + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + status, err := rollStatusFromHttpResponse(resp) + if err != nil { + return nil, err + } + + return status, nil +} + func (s *ServiceOp) RollECS(ctx context.Context, input *RollECSGroupInput) (*RollGroupOutput, error) { path, err := uritemplates.Expand("/aws/ec2/group/{groupId}/clusterRoll", uritemplates.Values{ "groupId": spotinst.StringValue(input.GroupID), @@ -2099,6 +2212,13 @@ func (o *Group) SetRegion(v *string) *Group { return o } +func (o *Group) SetLogging(v *Logging) *Group { + if o.Logging = v; o.Logging == nil { + o.nullFields = append(o.nullFields, "Logging") + } + return o +} + // endregion // region Integration @@ -2172,13 +2292,6 @@ func (o *Integration) SetMesosphere(v *MesosphereIntegration) *Integration { return o } -func (o *Integration) SetMultai(v *MultaiIntegration) *Integration { - if o.Multai = v; o.Multai == nil { - o.nullFields = append(o.nullFields, "Multai") - } - return o -} - func (o *Integration) SetNomad(v *NomadIntegration) *Integration { if o.Nomad = v; o.Nomad == nil { o.nullFields = append(o.nullFields, "Nomad") @@ -2806,23 +2919,6 @@ func (o *MesosphereIntegration) SetServer(v *string) *MesosphereIntegration { // endregion -// region MultaiIntegration - -func (o MultaiIntegration) MarshalJSON() ([]byte, error) { - type noMethod MultaiIntegration - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *MultaiIntegration) SetDeploymentId(v *string) *MultaiIntegration { - if o.DeploymentID = v; o.DeploymentID == nil { - o.nullFields = append(o.nullFields, "DeploymentID") - } - return o -} - -// endregion - // region NomadIntegration func (o NomadIntegration) MarshalJSON() ([]byte, error) { @@ -3619,6 +3715,12 @@ func (o *Strategy) SetMinimumInstanceLifetime(v *int) *Strategy { } return o } +func (o *Strategy) SetRestrictSingleAz(v *bool) *Strategy { + if o.RestrictSingleAz = v; o.RestrictSingleAz == nil { + o.nullFields = append(o.nullFields, "RestrictSingleAz") + } + return o +} func (o *Strategy) SetConsiderODPricing(v *bool) *Strategy { if o.ConsiderODPricing = v; o.ConsiderODPricing == nil { o.nullFields = append(o.nullFields, "ConsiderODPricing") @@ -4260,6 +4362,13 @@ func (o *LaunchSpecification) SetITF(v *ITF) *LaunchSpecification { return o } +func (o *LaunchSpecification) SetAutoHealing(v *bool) *LaunchSpecification { + if o.AutoHealing = v; o.AutoHealing == nil { + o.nullFields = append(o.nullFields, "AutoHealing") + } + return o +} + // endregion // region Matcher @@ -4572,34 +4681,6 @@ func (o *LoadBalancer) SetType(v *string) *LoadBalancer { return o } -func (o *LoadBalancer) SetBalancerId(v *string) *LoadBalancer { - if o.BalancerID = v; o.BalancerID == nil { - o.nullFields = append(o.nullFields, "BalancerID") - } - return o -} - -func (o *LoadBalancer) SetTargetSetId(v *string) *LoadBalancer { - if o.TargetSetID = v; o.TargetSetID == nil { - o.nullFields = append(o.nullFields, "TargetSetID") - } - return o -} - -func (o *LoadBalancer) SetZoneAwareness(v *bool) *LoadBalancer { - if o.ZoneAwareness = v; o.ZoneAwareness == nil { - o.nullFields = append(o.nullFields, "ZoneAwareness") - } - return o -} - -func (o *LoadBalancer) SetAutoWeight(v *bool) *LoadBalancer { - if o.AutoWeight = v; o.AutoWeight == nil { - o.nullFields = append(o.nullFields, "AutoWeight") - } - return o -} - // endregion // region NetworkInterface @@ -4777,6 +4858,74 @@ func (o *EBS) SetThroughput(v *int) *EBS { return o } +func (o *EBS) SetDynamicIOPS(v *DynamicIOPS) *EBS { + if o.DynamicIOPS = v; o.DynamicIOPS == nil { + o.nullFields = append(o.nullFields, "DynamicIOPS") + } + return o +} + +func (o *EBS) SetDynamicVolumeSize(v *DynamicVolumeSize) *EBS { + if o.DynamicVolumeSize = v; o.DynamicVolumeSize == nil { + o.nullFields = append(o.nullFields, "DynamicVolumeSize") + } + return o +} + +func (o DynamicVolumeSize) MarshalJSON() ([]byte, error) { + type noMethod DynamicVolumeSize + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *DynamicVolumeSize) SetBaseSize(v *int) *DynamicVolumeSize { + if o.BaseSize = v; o.BaseSize == nil { + o.nullFields = append(o.nullFields, "BaseSize") + } + return o +} + +func (o *DynamicVolumeSize) SetResource(v *string) *DynamicVolumeSize { + if o.Resource = v; o.Resource == nil { + o.nullFields = append(o.nullFields, "Resource") + } + return o +} + +func (o *DynamicVolumeSize) SetSizePerResourceUnit(v *int) *DynamicVolumeSize { + if o.SizePerResourceUnit = v; o.SizePerResourceUnit == nil { + o.nullFields = append(o.nullFields, "SizePerResourceUnit") + } + return o +} + +func (o DynamicIOPS) MarshalJSON() ([]byte, error) { + type noMethod DynamicIOPS + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *DynamicIOPS) SetBaseSize(v *int) *DynamicIOPS { + if o.BaseSize = v; o.BaseSize == nil { + o.nullFields = append(o.nullFields, "BaseSize") + } + return o +} + +func (o *DynamicIOPS) SetResource(v *string) *DynamicIOPS { + if o.Resource = v; o.Resource == nil { + o.nullFields = append(o.nullFields, "Resource") + } + return o +} + +func (o *DynamicIOPS) SetSizePerResourceUnit(v *int) *DynamicIOPS { + if o.SizePerResourceUnit = v; o.SizePerResourceUnit == nil { + o.nullFields = append(o.nullFields, "SizePerResourceUnit") + } + return o +} + // endregion // region IAMInstanceProfile @@ -5502,3 +5651,54 @@ func (o *AMIs) SetShouldTag(v *bool) *AMIs { } // endregion + +// region Logging + +func (o Logging) MarshalJSON() ([]byte, error) { + type noMethod Logging + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *Logging) SetExport(v *Export) *Logging { + if o.Export = v; o.Export == nil { + o.nullFields = append(o.nullFields, "Export") + } + return o +} + +// endregion + +// region Export + +func (o Export) MarshalJSON() ([]byte, error) { + type noMethod Export + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *Export) SetS3(v *S3) *Export { + if o.S3 = v; o.S3 == nil { + o.nullFields = append(o.nullFields, "S3") + } + return o +} + +// endregion + +// region S3 + +func (o S3) MarshalJSON() ([]byte, error) { + type noMethod S3 + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *S3) SetId(v *string) *S3 { + if o.Id = v; o.Id == nil { + o.nullFields = append(o.nullFields, "Id") + } + return o +} + +// endregion diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/aws/service.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/aws/service.go index 944f3e6805..248b773821 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/aws/service.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/aws/service.go @@ -26,6 +26,7 @@ type Service interface { StopDeployment(context.Context, *StopDeploymentInput) (*StopDeploymentOutput, error) Roll(context.Context, *RollGroupInput) (*RollGroupOutput, error) + RollStatus(context.Context, *RollStatusInput) (*RollStatusOutput, error) RollECS(context.Context, *RollECSGroupInput) (*RollGroupOutput, error) GetInstanceHealthiness(context.Context, *GetInstanceHealthinessInput) (*GetInstanceHealthinessOutput, error) diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/azure.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/azure.go deleted file mode 100644 index 5b65689ef4..0000000000 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/azure.go +++ /dev/null @@ -1,2494 +0,0 @@ -package azure - -import ( - "context" - "encoding/json" - "io/ioutil" - "net/http" - "strconv" - "time" - - "github.com/spotinst/spotinst-sdk-go/spotinst" - "github.com/spotinst/spotinst-sdk-go/spotinst/client" - "github.com/spotinst/spotinst-sdk-go/spotinst/util/jsonutil" - "github.com/spotinst/spotinst-sdk-go/spotinst/util/uritemplates" -) - -type Group struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - Description *string `json:"description,omitempty"` - Region *string `json:"region,omitempty"` - Capacity *Capacity `json:"capacity,omitempty"` - Compute *Compute `json:"compute,omitempty"` - Strategy *Strategy `json:"strategy,omitempty"` - Scaling *Scaling `json:"scaling,omitempty"` - Scheduling *Scheduling `json:"scheduling,omitempty"` - Integration *Integration `json:"thirdPartiesIntegration,omitempty"` - - // Read-only fields. - CreatedAt *time.Time `json:"createdAt,omitempty"` - UpdatedAt *time.Time `json:"updatedAt,omitempty"` - - // forceSendFields is a list of field names (e.g. "Keys") to - // unconditionally include in API requests. By default, fields with - // empty values are omitted from API requests. However, any non-pointer, - // non-interface field appearing in ForceSendFields will be sent to the - // server regardless of whether the field is empty or not. This may be - // used to include empty fields in Patch requests. - forceSendFields []string - - // nullFields is a list of field names (e.g. "Keys") to include in API - // requests with the JSON null value. By default, fields with empty - // values are omitted from API requests. However, any field with an - // empty value appearing in NullFields will be sent to the server as - // null. It is an error if a field in this list has a non-empty value. - // This may be used to include null fields in Patch requests. - nullFields []string -} - -type Scheduling struct { - Tasks []*ScheduledTask `json:"tasks,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Integration struct { - Rancher *RancherIntegration `json:"rancher,omitempty"` - Kubernetes *KubernetesIntegration `json:"kubernetes,omitempty"` - Multai *MultaiIntegration `json:"mlbRuntime,omitempty"` - - forceSendFields []string - nullFields []string -} - -type KubernetesIntegration struct { - ClusterIdentifier *string `json:"clusterIdentifier,omitempty"` - - forceSendFields []string - nullFields []string -} - -type MultaiIntegration struct { - DeploymentID *string `json:"deploymentId,omitempty"` - - forceSendFields []string - nullFields []string -} - -type RancherIntegration struct { - MasterHost *string `json:"masterHost,omitempty"` - AccessKey *string `json:"accessKey,omitempty"` - SecretKey *string `json:"secretKey,omitempty"` - - forceSendFields []string - nullFields []string -} - -type ScheduledTask struct { - IsEnabled *bool `json:"isEnabled,omitempty"` - Frequency *string `json:"frequency,omitempty"` - CronExpression *string `json:"cronExpression,omitempty"` - TaskType *string `json:"taskType,omitempty"` - ScaleTargetCapacity *int `json:"scaleTargetCapacity,omitempty"` - ScaleMinCapacity *int `json:"scaleMinCapacity,omitempty"` - ScaleMaxCapacity *int `json:"scaleMaxCapacity,omitempty"` - BatchSizePercentage *int `json:"batchSizePercentage,omitempty"` - GracePeriod *int `json:"gracePeriod,omitempty"` - Adjustment *int `json:"adjustment,omitempty"` - AdjustmentPercentage *int `json:"adjustmentPercentage,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Scaling struct { - Up []*ScalingPolicy `json:"up,omitempty"` - Down []*ScalingPolicy `json:"down,omitempty"` - - forceSendFields []string - nullFields []string -} - -type ScalingPolicy struct { - PolicyName *string `json:"policyName,omitempty"` - MetricName *string `json:"metricName,omitempty"` - Statistic *string `json:"statistic,omitempty"` - Unit *string `json:"unit,omitempty"` - Threshold *float64 `json:"threshold,omitempty"` - Adjustment *int `json:"adjustment,omitempty"` - MinTargetCapacity *int `json:"minTargetCapacity,omitempty"` - MaxTargetCapacity *int `json:"maxTargetCapacity,omitempty"` - Namespace *string `json:"namespace,omitempty"` - EvaluationPeriods *int `json:"evaluationPeriods,omitempty"` - Period *int `json:"period,omitempty"` - Cooldown *int `json:"cooldown,omitempty"` - Operator *string `json:"operator,omitempty"` - Dimensions []*Dimension `json:"dimensions,omitempty"` - Action *Action `json:"action,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Action struct { - Type *string `json:"type,omitempty"` - Adjustment *string `json:"adjustment,omitempty"` - MinTargetCapacity *string `json:"minTargetCapacity,omitempty"` - MaxTargetCapacity *string `json:"maxTargetCapacity,omitempty"` - Maximum *string `json:"maximum,omitempty"` - Minimum *string `json:"minimum,omitempty"` - Target *string `json:"target,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Dimension struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Strategy struct { - LowPriorityPercentage *int `json:"lowPriorityPercentage,omitempty"` - OnDemandCount *int `json:"onDemandCount,omitempty"` - DrainingTimeout *int `json:"drainingTimeout,omitempty"` - Signals []*Signal `json:"signals,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Signal struct { - Name *string `json:"name,omitempty"` - Timeout *int `json:"timeout,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Capacity struct { - Minimum *int `json:"minimum,omitempty"` - Maximum *int `json:"maximum,omitempty"` - Target *int `json:"target,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Compute struct { - Region *string `json:"region,omitempty"` - Product *string `json:"product,omitempty"` - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - VMSizes *VMSizes `json:"vmSizes,omitempty"` - LaunchSpecification *LaunchSpecification `json:"launchSpecification,omitempty"` - Health *Health `json:"health,omitempty"` - - forceSendFields []string - nullFields []string -} - -type VMSizes struct { - OnDemand []string `json:"odSizes,omitempty"` - LowPriority []string `json:"lowPrioritySizes,omitempty"` - - forceSendFields []string - nullFields []string -} - -type LaunchSpecification struct { - LoadBalancersConfig *LoadBalancersConfig `json:"loadBalancersConfig,omitempty"` - Image *Image `json:"image,omitempty"` - UserData *string `json:"userData,omitempty"` - ShutdownScript *string `json:"shutdownScript,omitempty"` - Storage *Storage `json:"storage,omitempty"` - Network *Network `json:"network,omitempty"` - Login *Login `json:"login,omitempty"` - CustomData *string `json:"customData,omitempty"` - ManagedServiceIdentities []*ManagedServiceIdentity `json:"managedServiceIdentities,omitempty"` - - forceSendFields []string - nullFields []string -} - -type LoadBalancersConfig struct { - LoadBalancers []*LoadBalancer `json:"loadBalancers,omitempty"` - - forceSendFields []string - nullFields []string -} - -type LoadBalancer struct { - Type *string `json:"type,omitempty"` - BalancerID *string `json:"balancerId,omitempty"` - TargetSetID *string `json:"targetSetId,omitempty"` - AutoWeight *bool `json:"autoWeight,omitempty"` - - forceSendFields []string - nullFields []string -} - -type ManagedServiceIdentity struct { - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - Name *string `json:"name,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Image struct { - MarketPlace *MarketPlaceImage `json:"marketplace,omitempty"` - Custom *CustomImage `json:"custom,omitempty"` - - forceSendFields []string - nullFields []string -} - -type MarketPlaceImage struct { - Publisher *string `json:"publisher,omitempty"` - Offer *string `json:"offer,omitempty"` - SKU *string `json:"sku,omitempty"` - - forceSendFields []string - nullFields []string -} - -type CustomImage struct { - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - ImageName *string `json:"imageName,omitempty"` - - forceSendFields []string - nullFields []string -} - -type ResourceFile struct { - URL *string `json:"resourceFileUrl,omitempty"` - TargetPath *string `json:"resourceFileTargetPath,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Storage struct { - AccountName *string `json:"storageAccountName,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Network struct { - VirtualNetworkName *string `json:"virtualNetworkName,omitempty"` - SubnetName *string `json:"subnetName,omitempty"` - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - AssignPublicIP *bool `json:"assignPublicIp,omitempty"` - AdditionalIPConfigs []*AdditionalIPConfigs `json:"additionalIpConfigurations,omitempty"` - - forceSendFields []string - nullFields []string -} - -type AdditionalIPConfigs struct { - Name *string `json:"name,omitempty"` - PrivateIPAddressVersion *string `json:"privateIpAddressVersion,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Login struct { - UserName *string `json:"userName,omitempty"` - SSHPublicKey *string `json:"sshPublicKey,omitempty"` - Password *string `json:"password,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Health struct { - HealthCheckType *string `json:"healthCheckType,omitempty"` - AutoHealing *bool `json:"autoHealing,omitempty"` - GracePeriod *int `json:"gracePeriod,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Node struct { - ID *string `json:"id,omitempty"` - VMSize *string `json:"vmSize,omitempty"` - State *string `json:"state,omitempty"` - LifeCycle *string `json:"lifeCycle,omitempty"` - Region *string `json:"region,omitempty"` - IPAddress *string `json:"ipAddress,omitempty"` - CreatedAt *time.Time `json:"createdAt,omitempty"` -} - -type RollStrategy struct { - Action *string `json:"action,omitempty"` - ShouldDrainInstances *bool `json:"shouldDrainInstances,omitempty"` - - forceSendFields []string - nullFields []string -} - -type ListGroupsInput struct{} - -type ListGroupsOutput struct { - Groups []*Group `json:"groups,omitempty"` -} - -type CreateGroupInput struct { - Group *Group `json:"group,omitempty"` -} - -type CreateGroupOutput struct { - Group *Group `json:"group,omitempty"` -} - -type ReadGroupInput struct { - GroupID *string `json:"groupId,omitempty"` -} - -type ReadGroupOutput struct { - Group *Group `json:"group,omitempty"` -} - -type UpdateGroupInput struct { - Group *Group `json:"group,omitempty"` -} - -type UpdateGroupOutput struct { - Group *Group `json:"group,omitempty"` -} - -type DeleteGroupInput struct { - GroupID *string `json:"groupId,omitempty"` -} - -type DeleteGroupOutput struct{} - -type StatusGroupInput struct { - GroupID *string `json:"groupId,omitempty"` -} - -type StatusGroupOutput struct { - Nodes []*Node `json:"nodes,omitempty"` -} - -type ScaleGroupInput struct { - GroupID *string `json:"groupId,omitempty"` - ScaleType *string `json:"type,omitempty"` - Adjustment *int `json:"adjustment,omitempty"` -} - -type ScaleGroupOutput struct{} - -type DetachGroupInput struct { - GroupID *string `json:"groupId,omitempty"` - InstanceIDs []string `json:"instancesToDetach,omitempty"` - ShouldDecrementTargetCapacity *bool `json:"shouldDecrementTargetCapacity,omitempty"` - ShouldTerminateInstances *bool `json:"shouldTerminateInstances,omitempty"` - DrainingTimeout *int `json:"drainingTimeout,omitempty"` -} - -type DetachGroupOutput struct{} - -type RollGroupInput struct { - GroupID *string `json:"groupId,omitempty"` - BatchSizePercentage *int `json:"batchSizePercentage,omitempty"` - GracePeriod *int `json:"gracePeriod,omitempty"` - HealthCheckType *string `json:"healthCheckType,omitempty"` - Strategy *RollStrategy `json:"strategy,omitempty"` -} - -type RollGroupOutput struct { - Items []*RollItem `json:"items"` -} - -type Roll struct { - Status *string `json:"status,omitempty"` - - forceSendFields []string - nullFields []string -} - -type RollItem struct { - GroupID *string `json:"groupId,omitempty"` - RollID *string `json:"id,omitempty"` - Status *string `json:"status,omitempty"` - CurrentBatch *int `json:"currentBatch,omitempty"` - NumBatches *int `json:"numOfBatches,omitempty"` - Progress *RollProgress `json:"progress,omitempty"` -} - -type RollStatus struct { - GroupID *string `json:"groupId,omitempty"` - RollID *string `json:"id,omitempty"` - Status *string `json:"status,omitempty"` - Progress *RollProgress `json:"progress,omitempty"` - CreatedAt *string `json:"createdAt,omitempty"` - UpdatedAt *string `json:"updatedAt,omitempty"` - - forceSendFields []string - nullFields []string -} - -type RollProgress struct { - Unit *string `json:"unit,omitempty"` - Value *int `json:"value,omitempty"` - - forceSendFields []string - nullFields []string -} - -type StopRollInput struct { - GroupID *string `json:"groupId,omitempty"` - RollID *string `json:"rollId,omitempty"` - Roll *Roll `json:"roll,omitempty"` -} - -type StopRollOutput struct{} - -type RollStatusInput struct { - GroupID *string `json:"groupId,omitempty"` - RollID *string `json:"rollId,omitempty"` -} - -type RollStatusOutput struct { - RollStatus *RollStatus `json:"rollStatus,omitempty"` -} - -type ListRollStatusInput struct { - GroupID *string `json:"groupId,omitempty"` -} - -type ListRollStatusOutput struct { - Items []*RollStatus `json:"items"` -} - -type NodeSignal struct { - NodeID *string `json:"nodeId,omitempty"` - PoolID *string `json:"poolId,omitempty"` - Signal *string `json:"signal,omitempty"` - - forceSendFields []string - nullFields []string -} - -type NodeSignalInput struct { - NodeID *string `json:"nodeId,omitempty"` - PoolID *string `json:"poolId,omitempty"` - Signal *string `json:"signal,omitempty"` -} - -type NodeSignalOutput struct{} - -type Task struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Policies []*TaskPolicy `json:"policies,omitempty"` - Instances []*TaskInstance `json:"instances,omitempty"` - State *string `json:"state,omitempty"` - - forceSendFields []string - nullFields []string -} - -type TaskPolicy struct { - Cron *string `json:"cron,omitempty"` - Action *string `json:"action,omitempty"` - - forceSendFields []string - nullFields []string -} - -type TaskInstance struct { - VMName *string `json:"vmName,omitempty"` - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - - forceSendFields []string - nullFields []string -} - -type ListTasksInput struct{} - -type ListTasksOutput struct { - Tasks []*Task `json:"tasks,omitempty"` -} - -type CreateTaskInput struct { - Task *Task `json:"task,omitempty"` -} - -type CreateTaskOutput struct { - Task *Task `json:"task,omitempty"` -} - -type ReadTaskInput struct { - TaskID *string `json:"taskId,omitempty"` -} - -type ReadTaskOutput struct { - Task *Task `json:"task,omitempty"` -} - -type UpdateTaskInput struct { - Task *Task `json:"task,omitempty"` -} - -type UpdateTaskOutput struct { - Task *Task `json:"task,omitempty"` -} - -type DeleteTaskInput struct { - TaskID *string `json:"id,omitempty"` -} - -type DeleteTaskOutput struct{} - -// region Unmarshallers - -func groupFromJSON(in []byte) (*Group, error) { - b := new(Group) - if err := json.Unmarshal(in, b); err != nil { - return nil, err - } - return b, nil -} - -func groupsFromJSON(in []byte) ([]*Group, error) { - var rw client.Response - if err := json.Unmarshal(in, &rw); err != nil { - return nil, err - } - out := make([]*Group, len(rw.Response.Items)) - if len(out) == 0 { - return out, nil - } - for i, rb := range rw.Response.Items { - b, err := groupFromJSON(rb) - if err != nil { - return nil, err - } - out[i] = b - } - return out, nil -} - -func groupsFromHttpResponse(resp *http.Response) ([]*Group, error) { - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - return groupsFromJSON(body) -} - -func nodeFromJSON(in []byte) (*Node, error) { - b := new(Node) - if err := json.Unmarshal(in, b); err != nil { - return nil, err - } - return b, nil -} - -func nodesFromJSON(in []byte) ([]*Node, error) { - var rw client.Response - if err := json.Unmarshal(in, &rw); err != nil { - return nil, err - } - out := make([]*Node, len(rw.Response.Items)) - if len(out) == 0 { - return out, nil - } - for i, rb := range rw.Response.Items { - b, err := nodeFromJSON(rb) - if err != nil { - return nil, err - } - out[i] = b - } - return out, nil -} - -func nodesFromHttpResponse(resp *http.Response) ([]*Node, error) { - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - return nodesFromJSON(body) -} - -func tasksFromHttpResponse(resp *http.Response) ([]*Task, error) { - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - return tasksFromJSON(body) -} - -func taskFromJSON(in []byte) (*Task, error) { - b := new(Task) - if err := json.Unmarshal(in, b); err != nil { - return nil, err - } - return b, nil -} - -func tasksFromJSON(in []byte) ([]*Task, error) { - var rw client.Response - if err := json.Unmarshal(in, &rw); err != nil { - return nil, err - } - out := make([]*Task, len(rw.Response.Items)) - if len(out) == 0 { - return out, nil - } - for i, rb := range rw.Response.Items { - b, err := taskFromJSON(rb) - if err != nil { - return nil, err - } - out[i] = b - } - return out, nil -} - -func rollResponseFromJSON(in []byte) (*RollGroupOutput, error) { - var rw client.Response - if err := json.Unmarshal(in, &rw); err != nil { - return nil, err - } - - var retVal RollGroupOutput - retVal.Items = make([]*RollItem, len(rw.Response.Items)) - for i, rb := range rw.Response.Items { - b, err := rollItemFromJSON(rb) - if err != nil { - return nil, err - } - retVal.Items[i] = b - } - - return &retVal, nil -} - -func rollItemFromJSON(in []byte) (*RollItem, error) { - var rw *RollItem - if err := json.Unmarshal(in, &rw); err != nil { - return nil, err - } - return rw, nil -} - -func rollStatusFromJSON(in []byte) (*RollStatus, error) { - b := new(RollStatus) - if err := json.Unmarshal(in, b); err != nil { - return nil, err - } - return b, nil -} - -func rollStatusesFromJSON(in []byte) ([]*RollStatus, error) { - var rw client.Response - if err := json.Unmarshal(in, &rw); err != nil { - return nil, err - } - out := make([]*RollStatus, len(rw.Response.Items)) - if len(out) == 0 { - return out, nil - } - for i, rb := range rw.Response.Items { - b, err := rollStatusFromJSON(rb) - if err != nil { - return nil, err - } - out[i] = b - } - return out, nil -} - -func rollFromHttpResponse(resp *http.Response) (*RollGroupOutput, error) { - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - return rollResponseFromJSON(body) -} - -func rollStatusesFromHttpResponse(resp *http.Response) ([]*RollStatus, error) { - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - return rollStatusesFromJSON(body) -} - -func nodeSignalFromJSON(in []byte) (*NodeSignal, error) { - b := new(NodeSignal) - if err := json.Unmarshal(in, b); err != nil { - return nil, err - } - return b, nil -} - -func nodeSignalFromHttpResponse(resp *http.Response) (*NodeSignal, error) { - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - return nodeSignalFromJSON(body) -} - -// endregion - -// region API requests - -func (s *ServiceOp) List(ctx context.Context, input *ListGroupsInput) (*ListGroupsOutput, error) { - r := client.NewRequest(http.MethodGet, "/compute/azure/group") - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - gs, err := groupsFromHttpResponse(resp) - if err != nil { - return nil, err - } - - return &ListGroupsOutput{Groups: gs}, nil -} - -func (s *ServiceOp) Create(ctx context.Context, input *CreateGroupInput) (*CreateGroupOutput, error) { - r := client.NewRequest(http.MethodPost, "/azure/compute/group") - r.Obj = input - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - gs, err := groupsFromHttpResponse(resp) - if err != nil { - return nil, err - } - - output := new(CreateGroupOutput) - if len(gs) > 0 { - output.Group = gs[0] - } - - return output, nil -} - -func (s *ServiceOp) Read(ctx context.Context, input *ReadGroupInput) (*ReadGroupOutput, error) { - path, err := uritemplates.Expand("/compute/azure/group/{groupId}", uritemplates.Values{ - "groupId": spotinst.StringValue(input.GroupID), - }) - if err != nil { - return nil, err - } - - r := client.NewRequest(http.MethodGet, path) - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - gs, err := groupsFromHttpResponse(resp) - if err != nil { - return nil, err - } - - output := new(ReadGroupOutput) - if len(gs) > 0 { - output.Group = gs[0] - } - - return output, nil -} - -func (s *ServiceOp) Update(ctx context.Context, input *UpdateGroupInput) (*UpdateGroupOutput, error) { - path, err := uritemplates.Expand("/compute/azure/group/{groupId}", uritemplates.Values{ - "groupId": spotinst.StringValue(input.Group.ID), - }) - if err != nil { - return nil, err - } - - // We do NOT need the ID anymore, so let's drop it. - input.Group.ID = nil - - r := client.NewRequest(http.MethodPut, path) - r.Obj = input - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - gs, err := groupsFromHttpResponse(resp) - if err != nil { - return nil, err - } - - output := new(UpdateGroupOutput) - if len(gs) > 0 { - output.Group = gs[0] - } - - return output, nil -} - -func (s *ServiceOp) Delete(ctx context.Context, input *DeleteGroupInput) (*DeleteGroupOutput, error) { - path, err := uritemplates.Expand("/compute/azure/group/{groupId}", uritemplates.Values{ - "groupId": spotinst.StringValue(input.GroupID), - }) - if err != nil { - return nil, err - } - - r := client.NewRequest(http.MethodDelete, path) - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - return &DeleteGroupOutput{}, nil -} - -func (s *ServiceOp) Status(ctx context.Context, input *StatusGroupInput) (*StatusGroupOutput, error) { - path, err := uritemplates.Expand("/compute/azure/group/{groupId}/status", uritemplates.Values{ - "groupId": spotinst.StringValue(input.GroupID), - }) - if err != nil { - return nil, err - } - - r := client.NewRequest(http.MethodGet, path) - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - ns, err := nodesFromHttpResponse(resp) - if err != nil { - return nil, err - } - - return &StatusGroupOutput{Nodes: ns}, nil -} - -func (s *ServiceOp) Detach(ctx context.Context, input *DetachGroupInput) (*DetachGroupOutput, error) { - path, err := uritemplates.Expand("/compute/azure/group/{groupId}/detachNodes", uritemplates.Values{ - "groupId": spotinst.StringValue(input.GroupID), - }) - if err != nil { - return nil, err - } - - // We do not need the ID anymore so let's drop it. - input.GroupID = nil - - r := client.NewRequest(http.MethodPut, path) - r.Obj = input - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - return &DetachGroupOutput{}, nil -} - -func (s *ServiceOp) ListTasks(ctx context.Context, input *ListTasksInput) (*ListTasksOutput, error) { - r := client.NewRequest(http.MethodGet, "/azure/compute/task") - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - tasks, err := tasksFromHttpResponse(resp) - if err != nil { - return nil, err - } - - return &ListTasksOutput{Tasks: tasks}, nil -} - -func (s *ServiceOp) CreateTask(ctx context.Context, input *CreateTaskInput) (*CreateTaskOutput, error) { - r := client.NewRequest(http.MethodPost, "/azure/compute/task") - r.Obj = input.Task - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - tasks, err := tasksFromHttpResponse(resp) - if err != nil { - return nil, err - } - - output := new(CreateTaskOutput) - if len(tasks) > 0 { - output.Task = tasks[0] - } - - return output, nil -} - -func (s *ServiceOp) ReadTask(ctx context.Context, input *ReadTaskInput) (*ReadTaskOutput, error) { - path, err := uritemplates.Expand("/azure/compute/task/{taskId}", uritemplates.Values{ - "taskId": spotinst.StringValue(input.TaskID), - }) - if err != nil { - return nil, err - } - - r := client.NewRequest(http.MethodGet, path) - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - tasks, err := tasksFromHttpResponse(resp) - if err != nil { - return nil, err - } - - output := new(ReadTaskOutput) - if len(tasks) > 0 { - output.Task = tasks[0] - } - - return output, nil -} - -func (s *ServiceOp) UpdateTask(ctx context.Context, input *UpdateTaskInput) (*UpdateTaskOutput, error) { - path, err := uritemplates.Expand("/azure/compute/task/{taskId}", uritemplates.Values{ - "taskId": spotinst.StringValue(input.Task.ID), - }) - if err != nil { - return nil, err - } - - // We do not need the ID anymore so let's drop it. - input.Task.ID = nil - - r := client.NewRequest(http.MethodPut, path) - r.Obj = input.Task - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - tasks, err := tasksFromHttpResponse(resp) - if err != nil { - return nil, err - } - - output := new(UpdateTaskOutput) - if len(tasks) > 0 { - output.Task = tasks[0] - } - - return output, nil -} - -func (s *ServiceOp) DeleteTask(ctx context.Context, input *DeleteTaskInput) (*DeleteTaskOutput, error) { - path, err := uritemplates.Expand("/azure/compute/task/{taskId}", uritemplates.Values{ - "taskId": spotinst.StringValue(input.TaskID), - }) - if err != nil { - return nil, err - } - - r := client.NewRequest(http.MethodDelete, path) - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - return &DeleteTaskOutput{}, nil -} - -func (s *ServiceOp) Roll(ctx context.Context, input *RollGroupInput) (*RollGroupOutput, error) { - path, err := uritemplates.Expand("/compute/azure/group/{groupId}/roll", uritemplates.Values{ - "groupId": spotinst.StringValue(input.GroupID), - }) - if err != nil { - return nil, err - } - - // We do not need the ID anymore so let's drop it. - input.GroupID = nil - - r := client.NewRequest(http.MethodPut, path) - r.Obj = input - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - output, err := rollFromHttpResponse(resp) - if err != nil { - return nil, err - } - - return output, nil -} - -func (s *ServiceOp) GetRollStatus(ctx context.Context, input *RollStatusInput) (*RollStatusOutput, error) { - path, err := uritemplates.Expand("/compute/azure/group/{groupId}/roll/{rollId}", uritemplates.Values{ - "groupId": spotinst.StringValue(input.GroupID), - "rollId": spotinst.StringValue(input.RollID), - }) - if err != nil { - return nil, err - } - - // We do not need the ID anymore so let's drop it. - input.GroupID = nil - - r := client.NewRequest(http.MethodGet, path) - r.Obj = input - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - rolls, err := rollStatusesFromHttpResponse(resp) - if err != nil { - return nil, err - } - - output := new(RollStatusOutput) - if len(rolls) > 0 { - output.RollStatus = rolls[0] - } - - return output, nil -} - -func (s *ServiceOp) ListRollStatus(ctx context.Context, input *ListRollStatusInput) (*ListRollStatusOutput, error) { - path, err := uritemplates.Expand("/compute/azure/group/{groupId}/roll", uritemplates.Values{ - "groupId": spotinst.StringValue(input.GroupID), - }) - if err != nil { - return nil, err - } - - // We do not need the ID anymore so let's drop it. - input.GroupID = nil - - r := client.NewRequest(http.MethodGet, path) - r.Obj = input - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - rolls, err := rollStatusesFromHttpResponse(resp) - if err != nil { - return nil, err - } - - return &ListRollStatusOutput{Items: rolls}, nil -} - -func (s *ServiceOp) StopRoll(ctx context.Context, input *StopRollInput) (*StopRollOutput, error) { - path, err := uritemplates.Expand("/compute/azure/group/{groupId}/roll/{rollId}", uritemplates.Values{ - "groupId": spotinst.StringValue(input.GroupID), - "rollId": spotinst.StringValue(input.RollID), - }) - if err != nil { - return nil, err - } - - // We do not need the IDs anymore so let's drop them. - input.GroupID = nil - input.RollID = nil - - r := client.NewRequest(http.MethodPut, path) - r.Obj = input - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - return &StopRollOutput{}, nil -} - -func (s *ServiceOp) CreateNodeSignal(ctx context.Context, input *NodeSignalInput) (*NodeSignalOutput, error) { - r := client.NewRequest(http.MethodPost, "compute/azure/node/signal") - r.Obj = input - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - ns, err := nodeSignalFromHttpResponse(resp) - if err != nil { - return nil, err - } - - output := new(NodeSignalOutput) - if ns != nil { - } - - return output, nil -} - -func (s *ServiceOp) Scale(ctx context.Context, input *ScaleGroupInput) (*ScaleGroupOutput, error) { - path, err := uritemplates.Expand("/compute/azure/group/{groupId}/scale/{type}", uritemplates.Values{ - "groupId": spotinst.StringValue(input.GroupID), - "type": spotinst.StringValue(input.ScaleType), - }) - if err != nil { - return nil, err - } - - // We do not need the ID anymore so let's drop it. - input.GroupID = nil - - r := client.NewRequest(http.MethodPut, path) - - if input.Adjustment != nil { - r.Params.Set("adjustment", strconv.Itoa(*input.Adjustment)) - } - r.Obj = input - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - return &ScaleGroupOutput{}, err -} - -// endregion - -// region Group - -func (o Group) MarshalJSON() ([]byte, error) { - type noMethod Group - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Group) SetId(v *string) *Group { - if o.ID = v; o.ID == nil { - o.nullFields = append(o.nullFields, "ID") - } - return o -} - -func (o *Group) SetName(v *string) *Group { - if o.Name = v; o.Name == nil { - o.nullFields = append(o.nullFields, "Name") - } - return o -} - -func (o *Group) SetResourceGroupName(v *string) *Group { - if o.ResourceGroupName = v; o.ResourceGroupName == nil { - o.nullFields = append(o.nullFields, "ResourceGroupName") - } - return o -} - -func (o *Group) SetDescription(v *string) *Group { - if o.Description = v; o.Description == nil { - o.nullFields = append(o.nullFields, "Description") - } - return o -} - -func (o *Group) SetCapacity(v *Capacity) *Group { - if o.Capacity = v; o.Capacity == nil { - o.nullFields = append(o.nullFields, "Capacity") - } - return o -} - -func (o *Group) SetCompute(v *Compute) *Group { - if o.Compute = v; o.Compute == nil { - o.nullFields = append(o.nullFields, "Compute") - } - return o -} - -func (o *Group) SetStrategy(v *Strategy) *Group { - if o.Strategy = v; o.Strategy == nil { - o.nullFields = append(o.nullFields, "Strategy") - } - return o -} - -func (o *Group) SetScaling(v *Scaling) *Group { - if o.Scaling = v; o.Scaling == nil { - o.nullFields = append(o.nullFields, "Scaling") - } - return o -} - -func (o *Group) SetScheduling(v *Scheduling) *Group { - if o.Scheduling = v; o.Scheduling == nil { - o.nullFields = append(o.nullFields, "Scheduling") - } - return o -} - -func (o *Group) SetIntegration(v *Integration) *Group { - if o.Integration = v; o.Integration == nil { - o.nullFields = append(o.nullFields, "Integration") - } - return o -} - -func (o *Group) SetRegion(v *string) *Group { - if o.Region = v; o.Region == nil { - o.nullFields = append(o.nullFields, "Region") - } - return o -} - -// endregion - -// region Scheduling - -func (o Scheduling) MarshalJSON() ([]byte, error) { - type noMethod Scheduling - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Scheduling) SetTasks(v []*ScheduledTask) *Scheduling { - if o.Tasks = v; o.Tasks == nil { - o.nullFields = append(o.nullFields, "Tasks") - } - return o -} - -// endregion - -// region Integration - -func (o Integration) MarshalJSON() ([]byte, error) { - type noMethod Integration - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Integration) SetKubernetes(v *KubernetesIntegration) *Integration { - if o.Kubernetes = v; o.Kubernetes == nil { - o.nullFields = append(o.nullFields, "Kubernetes") - } - return o -} - -func (o *Integration) SetMultai(v *MultaiIntegration) *Integration { - if o.Multai = v; o.Multai == nil { - o.nullFields = append(o.nullFields, "Multai") - } - return o -} - -func (o *Integration) SetRancher(v *RancherIntegration) *Integration { - if o.Rancher = v; o.Rancher == nil { - o.nullFields = append(o.nullFields, "Rancher") - } - return o -} - -// endregion - -// region KubernetesIntegration - -func (o KubernetesIntegration) MarshalJSON() ([]byte, error) { - type noMethod KubernetesIntegration - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *KubernetesIntegration) SetClusterIdentifier(v *string) *KubernetesIntegration { - if o.ClusterIdentifier = v; o.ClusterIdentifier == nil { - o.nullFields = append(o.nullFields, "ClusterIdentifier") - } - return o -} - -// endregion - -// region MultaiIntegration - -func (o MultaiIntegration) MarshalJSON() ([]byte, error) { - type noMethod MultaiIntegration - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *MultaiIntegration) SetDeploymentId(v *string) *MultaiIntegration { - if o.DeploymentID = v; o.DeploymentID == nil { - o.nullFields = append(o.nullFields, "DeploymentID") - } - return o -} - -// endregion - -// region RancherIntegration - -func (o RancherIntegration) MarshalJSON() ([]byte, error) { - type noMethod RancherIntegration - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *RancherIntegration) SetMasterHost(v *string) *RancherIntegration { - if o.MasterHost = v; o.MasterHost == nil { - o.nullFields = append(o.nullFields, "MasterHost") - } - return o -} - -func (o *RancherIntegration) SetAccessKey(v *string) *RancherIntegration { - if o.AccessKey = v; o.AccessKey == nil { - o.nullFields = append(o.nullFields, "AccessKey") - } - return o -} - -func (o *RancherIntegration) SetSecretKey(v *string) *RancherIntegration { - if o.SecretKey = v; o.SecretKey == nil { - o.nullFields = append(o.nullFields, "SecretKey") - } - return o -} - -// endregion - -// region ScheduledTask - -func (o ScheduledTask) MarshalJSON() ([]byte, error) { - type noMethod ScheduledTask - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *ScheduledTask) SetIsEnabled(v *bool) *ScheduledTask { - if o.IsEnabled = v; o.IsEnabled == nil { - o.nullFields = append(o.nullFields, "IsEnabled") - } - return o -} - -func (o *ScheduledTask) SetFrequency(v *string) *ScheduledTask { - if o.Frequency = v; o.Frequency == nil { - o.nullFields = append(o.nullFields, "Frequency") - } - return o -} - -func (o *ScheduledTask) SetCronExpression(v *string) *ScheduledTask { - if o.CronExpression = v; o.CronExpression == nil { - o.nullFields = append(o.nullFields, "CronExpression") - } - return o -} - -func (o *ScheduledTask) SetTaskType(v *string) *ScheduledTask { - if o.TaskType = v; o.TaskType == nil { - o.nullFields = append(o.nullFields, "TaskType") - } - return o -} - -func (o *ScheduledTask) SetScaleTargetCapacity(v *int) *ScheduledTask { - if o.ScaleTargetCapacity = v; o.ScaleTargetCapacity == nil { - o.nullFields = append(o.nullFields, "ScaleTargetCapacity") - } - return o -} - -func (o *ScheduledTask) SetScaleMinCapacity(v *int) *ScheduledTask { - if o.ScaleMinCapacity = v; o.ScaleMinCapacity == nil { - o.nullFields = append(o.nullFields, "ScaleMinCapacity") - } - return o -} - -func (o *ScheduledTask) SetScaleMaxCapacity(v *int) *ScheduledTask { - if o.ScaleMaxCapacity = v; o.ScaleMaxCapacity == nil { - o.nullFields = append(o.nullFields, "ScaleMaxCapacity") - } - return o -} - -func (o *ScheduledTask) SetBatchSizePercentage(v *int) *ScheduledTask { - if o.BatchSizePercentage = v; o.BatchSizePercentage == nil { - o.nullFields = append(o.nullFields, "BatchSizePercentage") - } - return o -} - -func (o *ScheduledTask) SetGracePeriod(v *int) *ScheduledTask { - if o.GracePeriod = v; o.GracePeriod == nil { - o.nullFields = append(o.nullFields, "GracePeriod") - } - return o -} - -func (o *ScheduledTask) SetAdjustment(v *int) *ScheduledTask { - if o.Adjustment = v; o.Adjustment == nil { - o.nullFields = append(o.nullFields, "Adjustment") - } - return o -} - -func (o *ScheduledTask) SetAdjustmentPercentage(v *int) *ScheduledTask { - if o.AdjustmentPercentage = v; o.AdjustmentPercentage == nil { - o.nullFields = append(o.nullFields, "AdjustmentPercentage") - } - return o -} - -// endregion - -// region Scaling - -func (o Scaling) MarshalJSON() ([]byte, error) { - type noMethod Scaling - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Scaling) SetUp(v []*ScalingPolicy) *Scaling { - if o.Up = v; o.Up == nil { - o.nullFields = append(o.nullFields, "Up") - } - return o -} - -func (o *Scaling) SetDown(v []*ScalingPolicy) *Scaling { - if o.Down = v; o.Down == nil { - o.nullFields = append(o.nullFields, "Down") - } - return o -} - -// endregion - -// region ScalingPolicy - -func (o ScalingPolicy) MarshalJSON() ([]byte, error) { - type noMethod ScalingPolicy - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *ScalingPolicy) SetPolicyName(v *string) *ScalingPolicy { - if o.PolicyName = v; o.PolicyName == nil { - o.nullFields = append(o.nullFields, "PolicyName") - } - return o -} - -func (o *ScalingPolicy) SetMetricName(v *string) *ScalingPolicy { - if o.MetricName = v; o.MetricName == nil { - o.nullFields = append(o.nullFields, "MetricName") - } - return o -} - -func (o *ScalingPolicy) SetStatistic(v *string) *ScalingPolicy { - if o.Statistic = v; o.Statistic == nil { - o.nullFields = append(o.nullFields, "Statistic") - } - return o -} - -func (o *ScalingPolicy) SetUnit(v *string) *ScalingPolicy { - if o.Unit = v; o.Unit == nil { - o.nullFields = append(o.nullFields, "Unit") - } - return o -} - -func (o *ScalingPolicy) SetThreshold(v *float64) *ScalingPolicy { - if o.Threshold = v; o.Threshold == nil { - o.nullFields = append(o.nullFields, "Threshold") - } - return o -} - -func (o *ScalingPolicy) SetAdjustment(v *int) *ScalingPolicy { - if o.Adjustment = v; o.Adjustment == nil { - o.nullFields = append(o.nullFields, "Adjustment") - } - return o -} - -func (o *ScalingPolicy) SetMinTargetCapacity(v *int) *ScalingPolicy { - if o.MinTargetCapacity = v; o.MinTargetCapacity == nil { - o.nullFields = append(o.nullFields, "MinTargetCapacity") - } - return o -} - -func (o *ScalingPolicy) SetMaxTargetCapacity(v *int) *ScalingPolicy { - if o.MaxTargetCapacity = v; o.MaxTargetCapacity == nil { - o.nullFields = append(o.nullFields, "MaxTargetCapacity") - } - return o -} - -func (o *ScalingPolicy) SetNamespace(v *string) *ScalingPolicy { - if o.Namespace = v; o.Namespace == nil { - o.nullFields = append(o.nullFields, "Namespace") - } - return o -} - -func (o *ScalingPolicy) SetEvaluationPeriods(v *int) *ScalingPolicy { - if o.EvaluationPeriods = v; o.EvaluationPeriods == nil { - o.nullFields = append(o.nullFields, "EvaluationPeriods") - } - return o -} - -func (o *ScalingPolicy) SetPeriod(v *int) *ScalingPolicy { - if o.Period = v; o.Period == nil { - o.nullFields = append(o.nullFields, "Period") - } - return o -} - -func (o *ScalingPolicy) SetCooldown(v *int) *ScalingPolicy { - if o.Cooldown = v; o.Cooldown == nil { - o.nullFields = append(o.nullFields, "Cooldown") - } - return o -} - -func (o *ScalingPolicy) SetOperator(v *string) *ScalingPolicy { - if o.Operator = v; o.Operator == nil { - o.nullFields = append(o.nullFields, "Operator") - } - return o -} - -func (o *ScalingPolicy) SetDimensions(v []*Dimension) *ScalingPolicy { - if o.Dimensions = v; o.Dimensions == nil { - o.nullFields = append(o.nullFields, "Dimensions") - } - return o -} - -func (o *ScalingPolicy) SetAction(v *Action) *ScalingPolicy { - if o.Action = v; o.Action == nil { - o.nullFields = append(o.nullFields, "Action") - } - return o -} - -// endregion - -// region Action - -func (o Action) MarshalJSON() ([]byte, error) { - type noMethod Action - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Action) SetType(v *string) *Action { - if o.Type = v; o.Type == nil { - o.nullFields = append(o.nullFields, "Type") - } - return o -} - -func (o *Action) SetAdjustment(v *string) *Action { - if o.Adjustment = v; o.Adjustment == nil { - o.nullFields = append(o.nullFields, "Adjustment") - } - return o -} - -func (o *Action) SetMinTargetCapacity(v *string) *Action { - if o.MinTargetCapacity = v; o.MinTargetCapacity == nil { - o.nullFields = append(o.nullFields, "MinTargetCapacity") - } - return o -} - -func (o *Action) SetMaxTargetCapacity(v *string) *Action { - if o.MaxTargetCapacity = v; o.MaxTargetCapacity == nil { - o.nullFields = append(o.nullFields, "MaxTargetCapacity") - } - return o -} - -func (o *Action) SetMaximum(v *string) *Action { - if o.Maximum = v; o.Maximum == nil { - o.nullFields = append(o.nullFields, "Maximum") - } - return o -} - -func (o *Action) SetMinimum(v *string) *Action { - if o.Minimum = v; o.Minimum == nil { - o.nullFields = append(o.nullFields, "Minimum") - } - return o -} - -func (o *Action) SetTarget(v *string) *Action { - if o.Target = v; o.Target == nil { - o.nullFields = append(o.nullFields, "Target") - } - return o -} - -// endregion - -// region Dimension - -func (o Dimension) MarshalJSON() ([]byte, error) { - type noMethod Dimension - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Dimension) SetName(v *string) *Dimension { - if o.Name = v; o.Name == nil { - o.nullFields = append(o.nullFields, "Name") - } - return o -} - -func (o *Dimension) SetValue(v *string) *Dimension { - if o.Value = v; o.Value == nil { - o.nullFields = append(o.nullFields, "Value") - } - return o -} - -// endregion - -// region Strategy - -func (o Strategy) MarshalJSON() ([]byte, error) { - type noMethod Strategy - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Strategy) SetLowPriorityPercentage(v *int) *Strategy { - if o.LowPriorityPercentage = v; o.LowPriorityPercentage == nil { - o.nullFields = append(o.nullFields, "LowPriorityPercentage") - } - return o -} - -func (o *Strategy) SetOnDemandCount(v *int) *Strategy { - if o.OnDemandCount = v; o.OnDemandCount == nil { - o.nullFields = append(o.nullFields, "OnDemandCount") - } - return o -} - -func (o *Strategy) SetDrainingTimeout(v *int) *Strategy { - if o.DrainingTimeout = v; o.DrainingTimeout == nil { - o.nullFields = append(o.nullFields, "DrainingTimeout") - } - return o -} - -func (o *Strategy) SetSignals(v []*Signal) *Strategy { - if o.Signals = v; o.Signals == nil { - o.nullFields = append(o.nullFields, "Signals") - } - return o -} - -// endregion - -// region Signal - -func (o Signal) MarshalJSON() ([]byte, error) { - type noMethod Signal - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Signal) SetName(v *string) *Signal { - if o.Name = v; o.Name == nil { - o.nullFields = append(o.nullFields, "Name") - } - return o -} - -func (o *Signal) SetTimeout(v *int) *Signal { - if o.Timeout = v; o.Timeout == nil { - o.nullFields = append(o.nullFields, "Timeout") - } - return o -} - -// endregion - -// region Capacity - -func (o Capacity) MarshalJSON() ([]byte, error) { - type noMethod Capacity - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Capacity) SetMinimum(v *int) *Capacity { - if o.Minimum = v; o.Minimum == nil { - o.nullFields = append(o.nullFields, "Minimum") - } - return o -} - -func (o *Capacity) SetMaximum(v *int) *Capacity { - if o.Maximum = v; o.Maximum == nil { - o.nullFields = append(o.nullFields, "Maximum") - } - return o -} - -func (o *Capacity) SetTarget(v *int) *Capacity { - if o.Target = v; o.Target == nil { - o.nullFields = append(o.nullFields, "Target") - } - return o -} - -// endregion - -// region Compute - -func (o Compute) MarshalJSON() ([]byte, error) { - type noMethod Compute - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Compute) SetRegion(v *string) *Compute { - if o.Region = v; o.Region == nil { - o.nullFields = append(o.nullFields, "Region") - } - return o -} - -func (o *Compute) SetProduct(v *string) *Compute { - if o.Product = v; o.Product == nil { - o.nullFields = append(o.nullFields, "Product") - } - return o -} - -func (o *Compute) SetResourceGroupName(v *string) *Compute { - if o.ResourceGroupName = v; o.ResourceGroupName == nil { - o.nullFields = append(o.nullFields, "ResourceGroupName") - } - return o -} - -func (o *Compute) SetVMSizes(v *VMSizes) *Compute { - if o.VMSizes = v; o.VMSizes == nil { - o.nullFields = append(o.nullFields, "VMSizes") - } - return o -} - -func (o *Compute) SetLaunchSpecification(v *LaunchSpecification) *Compute { - if o.LaunchSpecification = v; o.LaunchSpecification == nil { - o.nullFields = append(o.nullFields, "LaunchSpecification") - } - return o -} - -func (o *Compute) SetHealth(v *Health) *Compute { - if o.Health = v; o.Health == nil { - o.nullFields = append(o.nullFields, "Health") - } - return o -} - -// endregion - -// region VMSize - -func (o VMSizes) MarshalJSON() ([]byte, error) { - type noMethod VMSizes - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *VMSizes) SetOnDemand(v []string) *VMSizes { - if o.OnDemand = v; o.OnDemand == nil { - o.nullFields = append(o.nullFields, "OnDemand") - } - return o -} - -func (o *VMSizes) SetLowPriority(v []string) *VMSizes { - if o.LowPriority = v; o.LowPriority == nil { - o.nullFields = append(o.nullFields, "LowPriority") - } - return o -} - -// endregion - -// region LaunchSpecification - -func (o LaunchSpecification) MarshalJSON() ([]byte, error) { - type noMethod LaunchSpecification - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *LaunchSpecification) SetLoadBalancersConfig(v *LoadBalancersConfig) *LaunchSpecification { - if o.LoadBalancersConfig = v; o.LoadBalancersConfig == nil { - o.nullFields = append(o.nullFields, "LoadBalancersConfig") - } - return o -} - -func (o *LaunchSpecification) SetImage(v *Image) *LaunchSpecification { - if o.Image = v; o.Image == nil { - o.nullFields = append(o.nullFields, "Image") - } - return o -} - -func (o *LaunchSpecification) SetUserData(v *string) *LaunchSpecification { - if o.UserData = v; o.UserData == nil { - o.nullFields = append(o.nullFields, "UserData") - } - return o -} - -func (o *LaunchSpecification) SetCustomData(v *string) *LaunchSpecification { - if o.CustomData = v; o.CustomData == nil { - o.nullFields = append(o.nullFields, "CustomData") - } - return o -} - -func (o *LaunchSpecification) SetManagedServiceIdentities(v []*ManagedServiceIdentity) *LaunchSpecification { - if o.ManagedServiceIdentities = v; o.ManagedServiceIdentities == nil { - o.nullFields = append(o.nullFields, "ManagedServiceIdentities") - } - return o -} - -// SetShutdownScript sets the shutdown script used when draining instances -func (o *LaunchSpecification) SetShutdownScript(v *string) *LaunchSpecification { - if o.ShutdownScript = v; o.ShutdownScript == nil { - o.nullFields = append(o.nullFields, "ShutdownScript") - } - return o -} - -func (o *LaunchSpecification) SetStorage(v *Storage) *LaunchSpecification { - if o.Storage = v; o.Storage == nil { - o.nullFields = append(o.nullFields, "Storage") - } - return o -} - -func (o *LaunchSpecification) SetNetwork(v *Network) *LaunchSpecification { - if o.Network = v; o.Network == nil { - o.nullFields = append(o.nullFields, "Network") - } - return o -} - -func (o *LaunchSpecification) SetLogin(v *Login) *LaunchSpecification { - if o.Login = v; o.Login == nil { - o.nullFields = append(o.nullFields, "Login") - } - return o -} - -// endregion - -// region LoadBalancersConfig - -func (o LoadBalancersConfig) MarshalJSON() ([]byte, error) { - type noMethod LoadBalancersConfig - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *LoadBalancersConfig) SetLoadBalancers(v []*LoadBalancer) *LoadBalancersConfig { - if o.LoadBalancers = v; o.LoadBalancers == nil { - o.nullFields = append(o.nullFields, "LoadBalancers") - } - return o -} - -// endregion - -// region LoadBalancer - -func (o LoadBalancer) MarshalJSON() ([]byte, error) { - type noMethod LoadBalancer - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *LoadBalancer) SetType(v *string) *LoadBalancer { - if o.Type = v; o.Type == nil { - o.nullFields = append(o.nullFields, "Type") - } - return o -} - -func (o *LoadBalancer) SetBalancerId(v *string) *LoadBalancer { - if o.BalancerID = v; o.BalancerID == nil { - o.nullFields = append(o.nullFields, "BalancerID") - } - return o -} - -func (o *LoadBalancer) SetTargetSetId(v *string) *LoadBalancer { - if o.TargetSetID = v; o.TargetSetID == nil { - o.nullFields = append(o.nullFields, "TargetSetID") - } - return o -} - -func (o *LoadBalancer) SetAutoWeight(v *bool) *LoadBalancer { - if o.AutoWeight = v; o.AutoWeight == nil { - o.nullFields = append(o.nullFields, "AutoWeight") - } - return o -} - -// endregion - -// region ManagedServiceIdentity - -func (o ManagedServiceIdentity) MarshalJSON() ([]byte, error) { - type noMethod ManagedServiceIdentity - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *ManagedServiceIdentity) SetResourceGroupName(v *string) *ManagedServiceIdentity { - if o.ResourceGroupName = v; o.ResourceGroupName == nil { - o.nullFields = append(o.nullFields, "ResourceGroupName") - } - return o -} - -func (o *ManagedServiceIdentity) SetName(v *string) *ManagedServiceIdentity { - if o.Name = v; o.Name == nil { - o.nullFields = append(o.nullFields, "Name") - } - return o -} - -// endregion - -// region Image - -func (o Image) MarshalJSON() ([]byte, error) { - type noMethod Image - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Image) SetMarketPlaceImage(v *MarketPlaceImage) *Image { - if o.MarketPlace = v; o.MarketPlace == nil { - o.nullFields = append(o.nullFields, "MarketPlace") - } - return o -} - -func (o *Image) SetCustom(v *CustomImage) *Image { - if o.Custom = v; o.Custom == nil { - o.nullFields = append(o.nullFields, "Custom") - } - return o -} - -// endregion - -// region MarketPlaceImage - -func (o MarketPlaceImage) MarshalJSON() ([]byte, error) { - type noMethod MarketPlaceImage - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *MarketPlaceImage) SetPublisher(v *string) *MarketPlaceImage { - if o.Publisher = v; o.Publisher == nil { - o.nullFields = append(o.nullFields, "Publisher") - } - return o -} - -func (o *MarketPlaceImage) SetOffer(v *string) *MarketPlaceImage { - if o.Offer = v; o.Offer == nil { - o.nullFields = append(o.nullFields, "Offer") - } - return o -} - -func (o *MarketPlaceImage) SetSKU(v *string) *MarketPlaceImage { - if o.SKU = v; o.SKU == nil { - o.nullFields = append(o.nullFields, "SKU") - } - return o -} - -// endregion - -// region CustomImage - -func (o CustomImage) MarshalJSON() ([]byte, error) { - type noMethod CustomImage - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *CustomImage) SetResourceGroupName(v *string) *CustomImage { - if o.ResourceGroupName = v; o.ResourceGroupName == nil { - o.nullFields = append(o.nullFields, "ResourceGroupName") - } - return o -} - -func (o *CustomImage) SetImageName(v *string) *CustomImage { - if o.ImageName = v; o.ImageName == nil { - o.nullFields = append(o.nullFields, "ImageName") - } - return o -} - -// endregion - -// region ResourceFile - -func (o ResourceFile) MarshalJSON() ([]byte, error) { - type noMethod ResourceFile - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *ResourceFile) SetURL(v *string) *ResourceFile { - if o.URL = v; o.URL == nil { - o.nullFields = append(o.nullFields, "URL") - } - return o -} - -func (o *ResourceFile) SetTargetPath(v *string) *ResourceFile { - if o.TargetPath = v; o.TargetPath == nil { - o.nullFields = append(o.nullFields, "TargetPath") - } - return o -} - -// endregion - -// region Storage - -func (o Storage) MarshalJSON() ([]byte, error) { - type noMethod Storage - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Storage) SetAccountName(v *string) *Storage { - if o.AccountName = v; o.AccountName == nil { - o.nullFields = append(o.nullFields, "AccountName") - } - return o -} - -// endregion - -// region Network - -func (o Network) MarshalJSON() ([]byte, error) { - type noMethod Network - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Network) SetVirtualNetworkName(v *string) *Network { - if o.VirtualNetworkName = v; o.VirtualNetworkName == nil { - o.nullFields = append(o.nullFields, "VirtualNetworkName") - } - return o -} - -func (o *Network) SetSubnetName(v *string) *Network { - if o.SubnetName = v; o.SubnetName == nil { - o.nullFields = append(o.nullFields, "SubnetName") - } - return o -} - -func (o *Network) SetResourceGroupName(v *string) *Network { - if o.ResourceGroupName = v; o.ResourceGroupName == nil { - o.nullFields = append(o.nullFields, "ResourceGroupName") - } - return o -} - -func (o *Network) SetAssignPublicIP(v *bool) *Network { - if o.AssignPublicIP = v; o.AssignPublicIP == nil { - o.nullFields = append(o.nullFields, "AssignPublicIP") - } - return o -} - -// SetAdditionalIPConfigs sets the additional IP configurations -func (o *Network) SetAdditionalIPConfigs(v []*AdditionalIPConfigs) *Network { - if o.AdditionalIPConfigs = v; o.AdditionalIPConfigs == nil { - o.nullFields = append(o.nullFields, "AdditionalIPConfigs") - } - return o -} - -// endregion - -// region Login - -func (o Login) MarshalJSON() ([]byte, error) { - type noMethod Login - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Login) SetUserName(v *string) *Login { - if o.UserName = v; o.UserName == nil { - o.nullFields = append(o.nullFields, "UserName") - } - return o -} - -func (o *Login) SetSSHPublicKey(v *string) *Login { - if o.SSHPublicKey = v; o.SSHPublicKey == nil { - o.nullFields = append(o.nullFields, "SSHPublicKey") - } - return o -} - -func (o *Login) SetPassword(v *string) *Login { - if o.Password = v; o.Password == nil { - o.nullFields = append(o.nullFields, "Password") - } - return o -} - -// endregion - -// region AdditionalIPConfigs - -func (o AdditionalIPConfigs) MarshalJSON() ([]byte, error) { - type noMethod AdditionalIPConfigs - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -// SetName sets the name -func (o *AdditionalIPConfigs) SetName(v *string) *AdditionalIPConfigs { - if o.Name = v; o.Name == nil { - o.nullFields = append(o.nullFields, "Name") - } - return o -} - -// SetPrivateIPAddressVersion sets the ip address version -func (o *AdditionalIPConfigs) SetPrivateIPAddressVersion(v *string) *AdditionalIPConfigs { - if o.PrivateIPAddressVersion = v; o.PrivateIPAddressVersion == nil { - o.nullFields = append(o.nullFields, "PrivateIPAddressVersion") - } - return o -} - -// endregion - -// region Health - -func (o Health) MarshalJSON() ([]byte, error) { - type noMethod Health - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Health) SetHealthCheckType(v *string) *Health { - if o.HealthCheckType = v; o.HealthCheckType == nil { - o.nullFields = append(o.nullFields, "HealthCheckType") - } - return o -} - -func (o *Health) SetAutoHealing(v *bool) *Health { - if o.AutoHealing = v; o.AutoHealing == nil { - o.nullFields = append(o.nullFields, "AutoHealing") - } - return o -} - -func (o *Health) SetGracePeriod(v *int) *Health { - if o.GracePeriod = v; o.GracePeriod == nil { - o.nullFields = append(o.nullFields, "GracePeriod") - } - return o -} - -// endregion - -// region NodeSignal - -func (o NodeSignal) MarshalJSON() ([]byte, error) { - type noMethod NodeSignal - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *NodeSignal) SetNodeID(v *string) *NodeSignal { - if o.NodeID = v; o.NodeID == nil { - o.nullFields = append(o.nullFields, "NodeID") - } - return o -} - -func (o *NodeSignal) SetPoolID(v *string) *NodeSignal { - if o.PoolID = v; o.PoolID == nil { - o.nullFields = append(o.nullFields, "PoolID") - } - return o -} - -func (o *NodeSignal) SetSignal(v *string) *NodeSignal { - if o.Signal = v; o.Signal == nil { - o.nullFields = append(o.nullFields, "Signal") - } - return o -} - -// endregion - -// region Roll Group - -func (o RollStatus) MarshalJSON() ([]byte, error) { - type noMethod RollStatus - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *RollStatus) SetGroupID(v *string) *RollStatus { - if o.GroupID = v; o.GroupID == nil { - o.nullFields = append(o.nullFields, "GroupID") - } - return o -} - -func (o *RollStatus) SetRollID(v *string) *RollStatus { - if o.RollID = v; o.RollID == nil { - o.nullFields = append(o.nullFields, "RollID") - } - return o -} - -func (o *RollStatus) SetStatus(v *string) *RollStatus { - if o.Status = v; o.Status == nil { - o.nullFields = append(o.nullFields, "Status") - } - return o -} - -func (o *RollStatus) SetProgress(v *RollProgress) *RollStatus { - if o.Progress = v; o.Progress == nil { - o.nullFields = append(o.nullFields, "Progress") - } - return o -} - -// endregion - -// region RollProgress - -func (o RollProgress) MarshalJSON() ([]byte, error) { - type noMethod RollProgress - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *RollProgress) SetUnit(v *string) *RollProgress { - if o.Unit = v; o.Unit == nil { - o.nullFields = append(o.nullFields, "Unit") - } - return o -} - -func (o *RollProgress) SetValue(v *int) *RollProgress { - if o.Value = v; o.Value == nil { - o.nullFields = append(o.nullFields, "Value") - } - return o -} - -// endregion - -// region Roll - -func (o Roll) MarshalJSON() ([]byte, error) { - type noMethod Roll - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Roll) SetStatus(v *string) *Roll { - if o.Status = v; o.Status == nil { - o.nullFields = append(o.nullFields, "Status") - } - return o -} - -// endregion - -// region Tasks - -func (o Task) MarshalJSON() ([]byte, error) { - type noMethod Task - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Task) SetId(v *string) *Task { - if o.ID = v; o.ID == nil { - o.nullFields = append(o.nullFields, "ID") - } - return o -} - -func (o *Task) SetName(v *string) *Task { - if o.Name = v; o.Name == nil { - o.nullFields = append(o.nullFields, "Name") - } - return o -} - -func (o *Task) SetDescription(v *string) *Task { - if o.Description = v; o.Description == nil { - o.nullFields = append(o.nullFields, "Description") - } - return o -} - -func (o *Task) SetState(v *string) *Task { - if o.State = v; o.State == nil { - o.nullFields = append(o.nullFields, "State") - } - return o -} - -func (o *Task) SetPolicies(v []*TaskPolicy) *Task { - if o.Policies = v; o.Policies == nil { - o.nullFields = append(o.nullFields, "Policies") - } - return o -} - -func (o *Task) SetInstances(v []*TaskInstance) *Task { - if o.Instances = v; o.Instances == nil { - o.nullFields = append(o.nullFields, "Instances") - } - return o -} - -// endregion - -// region TaskPolicy - -func (o TaskPolicy) MarshalJSON() ([]byte, error) { - type noMethod TaskPolicy - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *TaskPolicy) SetCron(v *string) *TaskPolicy { - if o.Cron = v; o.Cron == nil { - o.nullFields = append(o.nullFields, "Cron") - } - return o -} - -func (o *TaskPolicy) SetAction(v *string) *TaskPolicy { - if o.Action = v; o.Action == nil { - o.nullFields = append(o.nullFields, "Action") - } - return o -} - -// endregion - -// region TaskInstance - -func (o TaskInstance) MarshalJSON() ([]byte, error) { - type noMethod TaskInstance - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *TaskInstance) SetVMName(v *string) *TaskInstance { - if o.VMName = v; o.VMName == nil { - o.nullFields = append(o.nullFields, "VMName") - } - return o -} - -func (o *TaskInstance) SetResourceGroupName(v *string) *TaskInstance { - if o.ResourceGroupName = v; o.ResourceGroupName == nil { - o.nullFields = append(o.nullFields, "ResourceGroupName") - } - return o -} - -// endregion diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/service.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/service.go deleted file mode 100644 index f15a3b0ebb..0000000000 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/service.go +++ /dev/null @@ -1,51 +0,0 @@ -package azure - -import ( - "context" - - "github.com/spotinst/spotinst-sdk-go/spotinst" - "github.com/spotinst/spotinst-sdk-go/spotinst/client" - "github.com/spotinst/spotinst-sdk-go/spotinst/session" -) - -// Service provides the API operation methods for making requests to endpoints -// of the Spotinst API. See this package's package overview docs for details on -// the service. -type Service interface { - List(context.Context, *ListGroupsInput) (*ListGroupsOutput, error) - Create(context.Context, *CreateGroupInput) (*CreateGroupOutput, error) - Read(context.Context, *ReadGroupInput) (*ReadGroupOutput, error) - Update(context.Context, *UpdateGroupInput) (*UpdateGroupOutput, error) - Delete(context.Context, *DeleteGroupInput) (*DeleteGroupOutput, error) - Status(context.Context, *StatusGroupInput) (*StatusGroupOutput, error) - Detach(context.Context, *DetachGroupInput) (*DetachGroupOutput, error) - Scale(context.Context, *ScaleGroupInput) (*ScaleGroupOutput, error) - CreateNodeSignal(context.Context, *NodeSignalInput) (*NodeSignalOutput, error) - - Roll(context.Context, *RollGroupInput) (*RollGroupOutput, error) - GetRollStatus(context.Context, *RollStatusInput) (*RollStatusOutput, error) - ListRollStatus(context.Context, *ListRollStatusInput) (*ListRollStatusOutput, error) - StopRoll(context.Context, *StopRollInput) (*StopRollOutput, error) - - ListTasks(context.Context, *ListTasksInput) (*ListTasksOutput, error) - CreateTask(context.Context, *CreateTaskInput) (*CreateTaskOutput, error) - ReadTask(context.Context, *ReadTaskInput) (*ReadTaskOutput, error) - UpdateTask(context.Context, *UpdateTaskInput) (*UpdateTaskOutput, error) - DeleteTask(context.Context, *DeleteTaskInput) (*DeleteTaskOutput, error) -} - -type ServiceOp struct { - Client *client.Client -} - -var _ Service = &ServiceOp{} - -func New(sess *session.Session, cfgs ...*spotinst.Config) *ServiceOp { - cfg := &spotinst.Config{} - cfg.Merge(sess.Config) - cfg.Merge(cfgs...) - - return &ServiceOp{ - Client: client.New(sess.Config), - } -} diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/tag.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/tag.go deleted file mode 100644 index b70da04994..0000000000 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/tag.go +++ /dev/null @@ -1,31 +0,0 @@ -package azure - -import "github.com/spotinst/spotinst-sdk-go/spotinst/util/jsonutil" - -type Tag struct { - Key *string `json:"tagKey,omitempty"` - Value *string `json:"tagValue,omitempty"` - - forceSendFields []string - nullFields []string -} - -func (o Tag) MarshalJSON() ([]byte, error) { - type noMethod Tag - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Tag) SetKey(v *string) *Tag { - if o.Key = v; o.Key == nil { - o.nullFields = append(o.nullFields, "Key") - } - return o -} - -func (o *Tag) SetValue(v *string) *Tag { - if o.Value = v; o.Value == nil { - o.nullFields = append(o.nullFields, "Value") - } - return o -} diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/v3/azure.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/v3/azure.go index 8f53835ca3..75b98a4c4c 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/v3/azure.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/v3/azure.go @@ -14,13 +14,17 @@ import ( ) type Group struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - Region *string `json:"region,omitempty"` - Capacity *Capacity `json:"capacity,omitempty"` - Compute *Compute `json:"compute,omitempty"` - Strategy *Strategy `json:"strategy,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + Region *string `json:"region,omitempty"` + Capacity *Capacity `json:"capacity,omitempty"` + Compute *Compute `json:"compute,omitempty"` + Strategy *Strategy `json:"strategy,omitempty"` + Scaling *Scaling `json:"scaling,omitempty"` + Description *string `json:"description,omitempty"` + Health *Health `json:"health,omitempty"` + Scheduling *Scheduling `json:"scheduling,omitempty"` // Read-only fields. CreatedAt *time.Time `json:"createdAt,omitempty"` @@ -44,10 +48,15 @@ type Group struct { } type Strategy struct { - OnDemandCount *int `json:"onDemandCount,omitempty"` - DrainingTimeout *int `json:"drainingTimeout,omitempty"` - SpotPercentage *int `json:"spotPercentage,omitempty"` - FallbackToOnDemand *bool `json:"fallbackToOd,omitempty"` + OnDemandCount *int `json:"onDemandCount,omitempty"` + DrainingTimeout *int `json:"drainingTimeout,omitempty"` + SpotPercentage *int `json:"spotPercentage,omitempty"` + FallbackToOnDemand *bool `json:"fallbackToOd,omitempty"` + AvailabilityVsCost *int `json:"availabilityVsCost,omitempty"` + CapacityReservation *CapacityReservation `json:"capacityReservation,omitempty"` + OptimizationWindows []string `json:"optimizationWindows,omitempty"` + RevertToSpot *RevertToSpot `json:"revertToSpot,omitempty"` + Signals []*Signals `json:"signals,omitempty"` forceSendFields []string nullFields []string @@ -66,28 +75,40 @@ type Compute struct { VMSizes *VMSizes `json:"vmSizes,omitempty"` OS *string `json:"os,omitempty"` LaunchSpecification *LaunchSpecification `json:"launchSpecification,omitempty"` + PreferredZones []string `json:"preferredZones,omitempty"` + Zones []string `json:"zones,omitempty"` forceSendFields []string nullFields []string } type VMSizes struct { - OnDemandSizes []string `json:"odSizes,omitempty"` - SpotSizes []string `json:"spotSizes,omitempty"` + OnDemandSizes []string `json:"odSizes,omitempty"` + SpotSizes []string `json:"spotSizes,omitempty"` + PreferredSpotSizes []string `json:"preferredSpotSizes,omitempty"` forceSendFields []string nullFields []string } type LaunchSpecification struct { - Image *Image `json:"image,omitempty"` - Network *Network `json:"network,omitempty"` - Login *Login `json:"login,omitempty"` - CustomData *string `json:"customData,omitempty"` - ManagedServiceIdentities []*ManagedServiceIdentity `json:"managedServiceIdentities,omitempty"` - Tags []*Tags `json:"tags,omitempty"` - LoadBalancersConfig *LoadBalancersConfig `json:"loadBalancersConfig,omitempty"` - ShutdownScript *string `json:"shutdownScript,omitempty"` + Image *Image `json:"image,omitempty"` + Network *Network `json:"network,omitempty"` + Login *Login `json:"login,omitempty"` + CustomData *string `json:"customData,omitempty"` + ManagedServiceIdentities []*ManagedServiceIdentity `json:"managedServiceIdentities,omitempty"` + Tags []*Tags `json:"tags,omitempty"` + LoadBalancersConfig *LoadBalancersConfig `json:"loadBalancersConfig,omitempty"` + ShutdownScript *string `json:"shutdownScript,omitempty"` + Extensions []*Extensions `json:"extensions,omitempty"` + BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` + DataDisks []*DataDisks `json:"dataDisks,omitempty"` + OsDisk *OsDisk `json:"osDisk,omitempty"` + ProximityPlacementGroups []*ProximityPlacementGroups `json:"proximityPlacementGroups,omitempty"` + Secrets []*Secrets `json:"secrets,omitempty"` + Security *Security `json:"security,omitempty"` + UserData *string `json:"userData,omitempty"` + VmNamePrefix *string `json:"vmNamePrefix,omitempty"` forceSendFields []string nullFields []string @@ -112,8 +133,9 @@ type LoadBalancer struct { } type Image struct { - MarketPlace *MarketPlaceImage `json:"marketplace,omitempty"` - Custom *CustomImage `json:"custom,omitempty"` + MarketPlace *MarketPlaceImage `json:"marketplace,omitempty"` + Custom *CustomImage `json:"custom,omitempty"` + GalleryImage *GalleryImage `json:"gallery,omitempty"` forceSendFields []string nullFields []string @@ -137,6 +159,17 @@ type CustomImage struct { nullFields []string } +type GalleryImage struct { + GalleryName *string `json:"galleryName,omitempty"` + ImageName *string `json:"imageName,omitempty"` + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + SpotAccountId *string `json:"spotAccountId,omitempty"` + Version *string `json:"version,omitempty"` + + forceSendFields []string + nullFields []string +} + type Network struct { VirtualNetworkName *string `json:"virtualNetworkName,omitempty"` ResourceGroupName *string `json:"resourceGroupName,omitempty"` @@ -152,6 +185,11 @@ type NetworkInterface struct { IsPrimary *bool `json:"isPrimary,omitempty"` AdditionalIPConfigs []*AdditionalIPConfig `json:"additionalIpConfigurations,omitempty"` ApplicationSecurityGroups []*ApplicationSecurityGroup `json:"applicationSecurityGroups,omitempty"` + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + PrivateIpAddresses []string `json:"privateIpAddresses,omitempty"` + PublicIps []*PublicIps `json:"publicIps,omitempty"` + PublicIpSku *string `json:"publicIpSku,omitempty"` + SecurityGroup *SecurityGroup `json:"securityGroup,omitempty"` forceSendFields []string nullFields []string @@ -198,6 +236,225 @@ type Tags struct { nullFields []string } +type Scaling struct { + Up []*ScalingPolicy `json:"up,omitempty"` + Down []*ScalingPolicy `json:"down,omitempty"` + + forceSendFields []string + nullFields []string +} + +type ScalingPolicy struct { + PolicyName *string `json:"policyName,omitempty"` + MetricName *string `json:"metricName,omitempty"` + Namespace *string `json:"namespace,omitempty"` + Statistic *string `json:"statistic,omitempty"` + Unit *string `json:"unit,omitempty"` + Threshold *float64 `json:"threshold,omitempty"` + EvaluationPeriods *int `json:"evaluationPeriods,omitempty"` + Period *int `json:"period,omitempty"` + Cooldown *int `json:"cooldown,omitempty"` + Operator *string `json:"operator,omitempty"` + Dimensions []*Dimensions `json:"dimensions,omitempty"` + Action *Action `json:"action,omitempty"` + Source *string `json:"source,omitempty"` + IsEnabled *bool `json:"isEnabled,omitempty"` + + forceSendFields []string + nullFields []string +} + +type Action struct { + Type *string `json:"type,omitempty"` + Adjustment *string `json:"adjustment,omitempty"` + Maximum *string `json:"maximum,omitempty"` + Minimum *string `json:"minimum,omitempty"` + Target *string `json:"target,omitempty"` + + forceSendFields []string + nullFields []string +} + +type Dimensions struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` + + forceSendFields []string + nullFields []string +} + +type Extensions struct { + APIVersion *string `json:"apiVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + MinorVersionAutoUpgrade *bool `json:"minorVersionAutoUpgrade,omitempty"` + Name *string `json:"name,omitempty"` + ProtectedSettingsFromKeyVault *ProtectedSettingsFromKeyVault `json:"protectedSettingsFromKeyVault,omitempty"` + ProtectedSettings map[string]interface{} `json:"protectedSettings,omitempty"` + PublicSettings map[string]interface{} `json:"publicSettings,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Type *string `json:"type,omitempty"` + + forceSendFields []string + nullFields []string +} +type ProtectedSettingsFromKeyVault struct { + SecretUrl *string `json:"secretUrl,omitempty"` + SourceVault *string `json:"sourceVault,omitempty"` + + forceSendFields []string + nullFields []string +} + +type Health struct { + AutoHealing *bool `json:"autoHealing,omitempty"` + GracePeriod *int `json:"gracePeriod,omitempty"` + HealthCheckTypes []string `json:"healthCheckTypes,omitempty"` + UnhealthyDuration *int `json:"unhealthyDuration,omitempty"` + + forceSendFields []string + nullFields []string +} + +type Scheduling struct { + Tasks []*Tasks `json:"tasks,omitempty"` + + forceSendFields []string + nullFields []string +} + +type Tasks struct { + CronExpression *string `json:"cronExpression,omitempty"` + IsEnabled *bool `json:"isEnabled,omitempty"` + ScaleMaxCapacity *int `json:"scaleMaxCapacity,omitempty"` + ScaleMinCapacity *int `json:"scaleMinCapacity,omitempty"` + ScaleTargetCapacity *int `json:"scaleTargetCapacity,omitempty"` + Type *string `json:"type,omitempty"` + Adjustment *int `json:"adjustment,omitempty"` + AdjustmentPercentage *int `json:"adjustmentPercentage,omitempty"` + BatchSizePercentage *int `json:"batchSizePercentage,omitempty"` + GracePeriod *int `json:"gracePeriod,omitempty"` + + forceSendFields []string + nullFields []string +} + +type DataDisks struct { + Lun *int `json:"lun,omitempty"` + SizeGB *int `json:"sizeGB,omitempty"` + Type *string `json:"type,omitempty"` + + forceSendFields []string + nullFields []string +} + +type OsDisk struct { + SizeGB *int `json:"sizeGB,omitempty"` + Type *string `json:"type,omitempty"` + + forceSendFields []string + nullFields []string +} + +type BootDiagnostics struct { + IsEnabled *bool `json:"isEnabled,omitempty"` + StorageUri *string `json:"storageUri,omitempty"` + Type *string `json:"type,omitempty"` + + forceSendFields []string + nullFields []string +} + +type ProximityPlacementGroups struct { + Name *string `json:"name,omitempty"` + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + + forceSendFields []string + nullFields []string +} + +type Secrets struct { + SourceVault *SourceVault `json:"sourceVault,omitempty"` + VaultCertificates []*VaultCertificates `json:"vaultCertificates,omitempty"` + + forceSendFields []string + nullFields []string +} + +type Security struct { + ConfidentialOsDiskEncryption *bool `json:"confidentialOsDiskEncryption,omitempty"` + SecureBootEnabled *bool `json:"secureBootEnabled,omitempty"` + SecurityType *string `json:"securityType,omitempty"` + VTpmEnabled *bool `json:"vTpmEnabled,omitempty"` + + forceSendFields []string + nullFields []string +} + +type SourceVault struct { + Name *string `json:"name,omitempty"` + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + + forceSendFields []string + nullFields []string +} + +type VaultCertificates struct { + CertificateStore *string `json:"certificateStore,omitempty"` + CertificateUrl *string `json:"certificateUrl,omitepmty"` + + forceSendFields []string + nullFields []string +} + +type CapacityReservation struct { + CapacityReservationGroups []*CapacityReservationGroups `json:"capacityReservationGroups,omitempty"` + ShouldUtilize *bool `json:"shouldUtilize,omitempty"` + UtilizationStrategy *string `json:"utilizationStrategy,omitempty"` + + forceSendFields []string + nullFields []string +} + +type CapacityReservationGroups struct { + Name *string `json:"name,omitempty"` + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + ShouldPrioritize *bool `json:"shouldPrioritize,omitempty"` + + forceSendFields []string + nullFields []string +} + +type RevertToSpot struct { + PerformAt *string `json:"performAt,omitempty"` + + forceSendFields []string + nullFields []string +} + +type Signals struct { + Type *string `json:"type,omitempty"` + Timeout *int `json:"timeout,omitempty"` + + forceSendFields []string + nullFields []string +} + +type PublicIps struct { + Name *string `json:"name,omitempty"` + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + + forceSendFields []string + nullFields []string +} + +type SecurityGroup struct { + Name *string `json:"name,omitempty"` + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + + forceSendFields []string + nullFields []string +} + type CreateGroupInput struct { Group *Group `json:"group,omitempty"` } @@ -452,6 +709,34 @@ func (o *Group) SetRegion(v *string) *Group { return o } +func (o *Group) SetScaling(v *Scaling) *Group { + if o.Scaling = v; o.Scaling == nil { + o.nullFields = append(o.nullFields, "Scaling") + } + return o +} + +func (o *Group) SetDescription(v *string) *Group { + if o.Description = v; o.Description == nil { + o.nullFields = append(o.nullFields, "Description") + } + return o +} + +func (o *Group) SetHealth(v *Health) *Group { + if o.Health = v; o.Health == nil { + o.nullFields = append(o.nullFields, "Health") + } + return o +} + +func (o *Group) SetScheduling(v *Scheduling) *Group { + if o.Scheduling = v; o.Scheduling == nil { + o.nullFields = append(o.nullFields, "Scheduling") + } + return o +} + // endregion // region Strategy @@ -490,6 +775,41 @@ func (o *Strategy) SetFallbackToOnDemand(v *bool) *Strategy { return o } +func (o *Strategy) SetAvailabilityVsCost(v *int) *Strategy { + if o.AvailabilityVsCost = v; o.AvailabilityVsCost == nil { + o.nullFields = append(o.nullFields, "AvailabilityVsCost") + } + return o +} + +func (o *Strategy) SetCapacityReservation(v *CapacityReservation) *Strategy { + if o.CapacityReservation = v; o.CapacityReservation == nil { + o.nullFields = append(o.nullFields, "CapacityReservation") + } + return o +} + +func (o *Strategy) SetOptimizationWindows(v []string) *Strategy { + if o.OptimizationWindows = v; o.OptimizationWindows == nil { + o.nullFields = append(o.nullFields, "OptimizationWindows") + } + return o +} + +func (o *Strategy) SetRevertToSpot(v *RevertToSpot) *Strategy { + if o.RevertToSpot = v; o.RevertToSpot == nil { + o.nullFields = append(o.nullFields, "RevertToSpot") + } + return o +} + +func (o *Strategy) SetSignals(v []*Signals) *Strategy { + if o.Signals = v; o.Signals == nil { + o.nullFields = append(o.nullFields, "Signals") + } + return o +} + // endregion // region Capacity @@ -552,6 +872,20 @@ func (o *Compute) SetLaunchSpecification(v *LaunchSpecification) *Compute { return o } +func (o *Compute) SetPreferredZones(v []string) *Compute { + if o.PreferredZones = v; o.PreferredZones == nil { + o.nullFields = append(o.nullFields, "PreferredZones") + } + return o +} + +func (o *Compute) SetZones(v []string) *Compute { + if o.Zones = v; o.Zones == nil { + o.nullFields = append(o.nullFields, "Zones") + } + return o +} + // endregion // region VMSize @@ -576,6 +910,13 @@ func (o *VMSizes) SetSpotSizes(v []string) *VMSizes { return o } +func (o *VMSizes) SetPreferredSpotSizes(v []string) *VMSizes { + if o.PreferredSpotSizes = v; o.PreferredSpotSizes == nil { + o.nullFields = append(o.nullFields, "PreferredSpotSizes") + } + return o +} + // endregion // region LaunchSpecification @@ -643,6 +984,69 @@ func (o *LaunchSpecification) SetTags(v []*Tags) *LaunchSpecification { return o } +func (o *LaunchSpecification) SetExtensions(v []*Extensions) *LaunchSpecification { + if o.Extensions = v; o.Extensions == nil { + o.nullFields = append(o.nullFields, "Extensions") + } + return o +} + +func (o *LaunchSpecification) SetBootDiagnostics(v *BootDiagnostics) *LaunchSpecification { + if o.BootDiagnostics = v; o.BootDiagnostics == nil { + o.nullFields = append(o.nullFields, "BootDiagnostics") + } + return o +} + +func (o *LaunchSpecification) SetDataDisks(v []*DataDisks) *LaunchSpecification { + if o.DataDisks = v; o.DataDisks == nil { + o.nullFields = append(o.nullFields, "DataDisks") + } + return o +} + +func (o *LaunchSpecification) SetOsDisk(v *OsDisk) *LaunchSpecification { + if o.OsDisk = v; o.OsDisk == nil { + o.nullFields = append(o.nullFields, "OsDisk") + } + return o +} + +func (o *LaunchSpecification) SetProximityPlacementGroups(v []*ProximityPlacementGroups) *LaunchSpecification { + if o.ProximityPlacementGroups = v; o.ProximityPlacementGroups == nil { + o.nullFields = append(o.nullFields, "ProximityPlacementGroups") + } + return o +} + +func (o *LaunchSpecification) SetSecrets(v []*Secrets) *LaunchSpecification { + if o.Secrets = v; o.Secrets == nil { + o.nullFields = append(o.nullFields, "Secrets") + } + return o +} + +func (o *LaunchSpecification) SetSecurity(v *Security) *LaunchSpecification { + if o.Security = v; o.Security == nil { + o.nullFields = append(o.nullFields, "Security") + } + return o +} + +func (o *LaunchSpecification) SetUserData(v *string) *LaunchSpecification { + if o.UserData = v; o.UserData == nil { + o.nullFields = append(o.nullFields, "UserData") + } + return o +} + +func (o *LaunchSpecification) SetVmNamePrefix(v *string) *LaunchSpecification { + if o.VmNamePrefix = v; o.VmNamePrefix == nil { + o.nullFields = append(o.nullFields, "VmNamePrefix") + } + return o +} + // endregion // region Image @@ -667,6 +1071,13 @@ func (o *Image) SetCustom(v *CustomImage) *Image { return o } +func (o *Image) SetGalleryImage(v *GalleryImage) *Image { + if o.GalleryImage = v; o.GalleryImage == nil { + o.nullFields = append(o.nullFields, "GalleryImage") + } + return o +} + // endregion // region MarketPlaceImage @@ -755,6 +1166,47 @@ func (o *CustomImage) SetName(v *string) *CustomImage { // endregion +func (o GalleryImage) MarshalJSON() ([]byte, error) { + type noMethod GalleryImage + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *GalleryImage) SetGalleryName(v *string) *GalleryImage { + if o.GalleryName = v; o.GalleryName == nil { + o.nullFields = append(o.nullFields, "GalleryName") + } + return o +} + +func (o *GalleryImage) SetImageName(v *string) *GalleryImage { + if o.ImageName = v; o.ImageName == nil { + o.nullFields = append(o.nullFields, "ImageName") + } + return o +} + +func (o *GalleryImage) SetResourceGroupName(v *string) *GalleryImage { + if o.ResourceGroupName = v; o.ResourceGroupName == nil { + o.nullFields = append(o.nullFields, "ResourceGroupName") + } + return o +} + +func (o *GalleryImage) SetSpotAccountId(v *string) *GalleryImage { + if o.SpotAccountId = v; o.SpotAccountId == nil { + o.nullFields = append(o.nullFields, "SpotAccountId") + } + return o +} + +func (o *GalleryImage) SetVersion(v *string) *GalleryImage { + if o.Version = v; o.Version == nil { + o.nullFields = append(o.nullFields, "Version") + } + return o +} + // region Network func (o Network) MarshalJSON() ([]byte, error) { @@ -829,6 +1281,41 @@ func (o *NetworkInterface) SetApplicationSecurityGroups(v []*ApplicationSecurity return o } +func (o *NetworkInterface) SetEnableIPForwarding(v *bool) *NetworkInterface { + if o.EnableIPForwarding = v; o.EnableIPForwarding == nil { + o.nullFields = append(o.nullFields, "EnableIPForwarding") + } + return o +} + +func (o *NetworkInterface) SetPrivateIpAddresses(v []string) *NetworkInterface { + if o.PrivateIpAddresses = v; o.PrivateIpAddresses == nil { + o.nullFields = append(o.nullFields, "PrivateIpAddresses") + } + return o +} + +func (o *NetworkInterface) SetPublicIps(v []*PublicIps) *NetworkInterface { + if o.PublicIps = v; o.PublicIps == nil { + o.nullFields = append(o.nullFields, "PublicIps") + } + return o +} + +func (o *NetworkInterface) SetPublicIpSku(v *string) *NetworkInterface { + if o.PublicIpSku = v; o.PublicIpSku == nil { + o.nullFields = append(o.nullFields, "PublicIpSku") + } + return o +} + +func (o *NetworkInterface) SetSecurityGroup(v *SecurityGroup) *NetworkInterface { + if o.SecurityGroup = v; o.SecurityGroup == nil { + o.nullFields = append(o.nullFields, "SecurityGroup") + } + return o +} + // endregion // region AdditionalIPConfig @@ -987,7 +1474,7 @@ func (o *LoadBalancer) SetSKU(v *string) *LoadBalancer { return o } -func (o *LoadBalancer) SeBackendPoolNames(v []string) *LoadBalancer { +func (o *LoadBalancer) SetBackendPoolNames(v []string) *LoadBalancer { if o.BackendPoolNames = v; o.BackendPoolNames == nil { o.nullFields = append(o.nullFields, "BackendPoolNames") } @@ -995,3 +1482,741 @@ func (o *LoadBalancer) SeBackendPoolNames(v []string) *LoadBalancer { } // endregion + +func (o Scaling) MarshalJSON() ([]byte, error) { + type noMethod Scaling + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *Scaling) SetUp(v []*ScalingPolicy) *Scaling { + if o.Up = v; o.Up == nil { + o.nullFields = append(o.nullFields, "Up") + } + return o +} + +func (o *Scaling) SetDown(v []*ScalingPolicy) *Scaling { + if o.Down = v; o.Down == nil { + o.nullFields = append(o.nullFields, "Down") + } + return o +} + +func (o ScalingPolicy) MarshalJSON() ([]byte, error) { + type noMethod ScalingPolicy + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *ScalingPolicy) SetPolicyName(v *string) *ScalingPolicy { + if o.PolicyName = v; o.PolicyName == nil { + o.nullFields = append(o.nullFields, "PolicyName") + } + return o +} + +func (o *ScalingPolicy) SetMetricName(v *string) *ScalingPolicy { + if o.MetricName = v; o.MetricName == nil { + o.nullFields = append(o.nullFields, "MetricName") + } + return o +} + +func (o *ScalingPolicy) SetNamespace(v *string) *ScalingPolicy { + if o.Namespace = v; o.Namespace == nil { + o.nullFields = append(o.nullFields, "Namespace") + } + return o +} + +func (o *ScalingPolicy) SetStatistic(v *string) *ScalingPolicy { + if o.Statistic = v; o.Statistic == nil { + o.nullFields = append(o.nullFields, "Statistic") + } + return o +} + +func (o *ScalingPolicy) SetUnit(v *string) *ScalingPolicy { + if o.Unit = v; o.Unit == nil { + o.nullFields = append(o.nullFields, "Unit") + } + return o +} + +func (o *ScalingPolicy) SetThreshold(v *float64) *ScalingPolicy { + if o.Threshold = v; o.Threshold == nil { + o.nullFields = append(o.nullFields, "Threshold") + } + return o +} + +func (o *ScalingPolicy) SetEvaluationPeriods(v *int) *ScalingPolicy { + if o.EvaluationPeriods = v; o.EvaluationPeriods == nil { + o.nullFields = append(o.nullFields, "EvaluationPeriods") + } + return o +} + +func (o *ScalingPolicy) SetPeriod(v *int) *ScalingPolicy { + if o.Period = v; o.Period == nil { + o.nullFields = append(o.nullFields, "Period") + } + return o +} + +func (o *ScalingPolicy) SetCooldown(v *int) *ScalingPolicy { + if o.Cooldown = v; o.Cooldown == nil { + o.nullFields = append(o.nullFields, "Cooldown") + } + return o +} + +func (o *ScalingPolicy) SetOperator(v *string) *ScalingPolicy { + if o.Operator = v; o.Operator == nil { + o.nullFields = append(o.nullFields, "Operator") + } + return o +} + +func (o *ScalingPolicy) SetDimensions(v []*Dimensions) *ScalingPolicy { + if o.Dimensions = v; o.Dimensions == nil { + o.nullFields = append(o.nullFields, "Dimensions") + } + return o +} + +func (o *ScalingPolicy) SetAction(v *Action) *ScalingPolicy { + if o.Action = v; o.Action == nil { + o.nullFields = append(o.nullFields, "Action") + } + return o +} + +func (o *ScalingPolicy) SetIsEnabled(v *bool) *ScalingPolicy { + if o.IsEnabled = v; o.IsEnabled == nil { + o.nullFields = append(o.nullFields, "IsEnabled") + } + return o +} + +func (o *ScalingPolicy) SetSource(v *string) *ScalingPolicy { + if o.Source = v; o.Source == nil { + o.nullFields = append(o.nullFields, "Source") + } + return o +} + +func (o Action) MarshalJSON() ([]byte, error) { + type noMethod Action + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *Action) SetType(v *string) *Action { + if o.Type = v; o.Type == nil { + o.nullFields = append(o.nullFields, "Type") + } + return o +} + +func (o *Action) SetAdjustment(v *string) *Action { + if o.Adjustment = v; o.Adjustment == nil { + o.nullFields = append(o.nullFields, "Adjustment") + } + return o +} + +func (o *Action) SetMaximum(v *string) *Action { + if o.Maximum = v; o.Maximum == nil { + o.nullFields = append(o.nullFields, "Maximum") + } + return o +} + +func (o *Action) SetMinimum(v *string) *Action { + if o.Minimum = v; o.Minimum == nil { + o.nullFields = append(o.nullFields, "Minimum") + } + return o +} + +func (o *Action) SetTarget(v *string) *Action { + if o.Target = v; o.Target == nil { + o.nullFields = append(o.nullFields, "Target") + } + return o +} + +// endregion + +// region Dimension + +func (o Dimensions) MarshalJSON() ([]byte, error) { + type noMethod Dimensions + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *Dimensions) SetName(v *string) *Dimensions { + if o.Name = v; o.Name == nil { + o.nullFields = append(o.nullFields, "Key") + } + return o +} + +func (o *Dimensions) SetValue(v *string) *Dimensions { + if o.Value = v; o.Value == nil { + o.nullFields = append(o.nullFields, "Value") + } + return o +} + +// endregion + +// region Extension + +func (o Extensions) MarshalJSON() ([]byte, error) { + type noMethod Extensions + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *Extensions) SetName(v *string) *Extensions { + if o.Name = v; o.Name == nil { + o.nullFields = append(o.nullFields, "Name") + } + return o +} + +func (o *Extensions) SetType(v *string) *Extensions { + if o.Type = v; o.Type == nil { + o.nullFields = append(o.nullFields, "Type") + } + return o +} + +func (o *Extensions) SetPublisher(v *string) *Extensions { + if o.Publisher = v; o.Publisher == nil { + o.nullFields = append(o.nullFields, "Publisher") + } + return o +} + +func (o *Extensions) SetAPIVersion(v *string) *Extensions { + if o.APIVersion = v; o.APIVersion == nil { + o.nullFields = append(o.nullFields, "APIVersion") + } + return o +} + +func (o *Extensions) SetMinorVersionAutoUpgrade(v *bool) *Extensions { + if o.MinorVersionAutoUpgrade = v; o.MinorVersionAutoUpgrade == nil { + o.nullFields = append(o.nullFields, "MinorVersionAutoUpgrade") + } + return o +} + +func (o *Extensions) SetEnableAutomaticUpgrade(v *bool) *Extensions { + if o.EnableAutomaticUpgrade = v; o.EnableAutomaticUpgrade == nil { + o.nullFields = append(o.nullFields, "EnableAutomaticUpgrade") + } + return o +} + +func (o *Extensions) SetProtectedSettings(v map[string]interface{}) *Extensions { + if o.ProtectedSettings = v; o.ProtectedSettings == nil { + o.nullFields = append(o.nullFields, "ProtectedSettings") + } + return o +} + +func (o *Extensions) SetProtectedSettingsFromKeyVault(v *ProtectedSettingsFromKeyVault) *Extensions { + if o.ProtectedSettingsFromKeyVault = v; o.ProtectedSettingsFromKeyVault == nil { + o.nullFields = append(o.nullFields, "ProtectedSettingsFromKeyVault") + } + return o +} + +func (o *Extensions) SetPublicSettings(v map[string]interface{}) *Extensions { + if o.PublicSettings = v; o.PublicSettings == nil { + o.nullFields = append(o.nullFields, "PublicSettings") + } + return o +} + +// endregion + +func (o ProtectedSettingsFromKeyVault) MarshalJSON() ([]byte, error) { + type noMethod ProtectedSettingsFromKeyVault + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *ProtectedSettingsFromKeyVault) SetSecretUrl(v *string) *ProtectedSettingsFromKeyVault { + if o.SecretUrl = v; o.SecretUrl == nil { + o.nullFields = append(o.nullFields, "SecretUrl") + } + return o +} + +func (o *ProtectedSettingsFromKeyVault) SetSourceVault(v *string) *ProtectedSettingsFromKeyVault { + if o.SourceVault = v; o.SourceVault == nil { + o.nullFields = append(o.nullFields, "SourceVault") + } + return o +} + +// region Signal + +func (o Signals) MarshalJSON() ([]byte, error) { + type noMethod Signals + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *Signals) SetType(v *string) *Signals { + if o.Type = v; o.Type == nil { + o.nullFields = append(o.nullFields, "Type") + } + return o +} + +func (o *Signals) SetTimeout(v *int) *Signals { + if o.Timeout = v; o.Timeout == nil { + o.nullFields = append(o.nullFields, "Timeout") + } + return o +} + +// endregion + +// region RevertToSpot + +func (o RevertToSpot) MarshalJSON() ([]byte, error) { + type noMethod RevertToSpot + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *RevertToSpot) SetPerformAt(v *string) *RevertToSpot { + if o.PerformAt = v; o.PerformAt == nil { + o.nullFields = append(o.nullFields, "PerformAt") + } + return o +} + +// endregion + +// region CapacityReservation + +func (o CapacityReservation) MarshalJSON() ([]byte, error) { + type noMethod CapacityReservation + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *CapacityReservation) SetShouldUtilize(v *bool) *CapacityReservation { + if o.ShouldUtilize = v; o.ShouldUtilize == nil { + o.nullFields = append(o.nullFields, "ShouldUtilize") + } + return o +} + +func (o *CapacityReservation) SetUtilizationStrategy(v *string) *CapacityReservation { + if o.UtilizationStrategy = v; o.UtilizationStrategy == nil { + o.nullFields = append(o.nullFields, "UtilizationStrategy") + } + return o +} + +func (o *CapacityReservation) SetCapacityReservationGroups(v []*CapacityReservationGroups) *CapacityReservation { + if o.CapacityReservationGroups = v; o.CapacityReservationGroups == nil { + o.nullFields = append(o.nullFields, "CapacityReservationGroups") + } + return o +} + +// endregion + +// region CapacityReservationGroup + +func (o CapacityReservationGroups) MarshalJSON() ([]byte, error) { + type noMethod CapacityReservationGroups + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *CapacityReservationGroups) SetName(v *string) *CapacityReservationGroups { + if o.Name = v; o.Name == nil { + o.nullFields = append(o.nullFields, "Name") + } + return o +} + +func (o *CapacityReservationGroups) SetResourceGroupName(v *string) *CapacityReservationGroups { + if o.ResourceGroupName = v; o.ResourceGroupName == nil { + o.nullFields = append(o.nullFields, "ResourceGroupName") + } + return o +} + +func (o *CapacityReservationGroups) SetShouldPrioritize(v *bool) *CapacityReservationGroups { + if o.ShouldPrioritize = v; o.ShouldPrioritize == nil { + o.nullFields = append(o.nullFields, "ShouldPrioritize") + } + return o +} + +// endregion + +func (o Health) MarshalJSON() ([]byte, error) { + type noMethod Health + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *Health) SetAutoHealing(v *bool) *Health { + if o.AutoHealing = v; o.AutoHealing == nil { + o.nullFields = append(o.nullFields, "AutoHealing") + } + return o +} + +func (o *Health) SetGracePeriod(v *int) *Health { + if o.GracePeriod = v; o.GracePeriod == nil { + o.nullFields = append(o.nullFields, "GracePeriod") + } + return o +} + +func (o *Health) SetHealthCheckTypes(v []string) *Health { + if o.HealthCheckTypes = v; o.HealthCheckTypes == nil { + o.nullFields = append(o.nullFields, "HealthCheckTypes") + } + return o +} + +func (o *Health) SetUnhealthyDuration(v *int) *Health { + if o.UnhealthyDuration = v; o.UnhealthyDuration == nil { + o.nullFields = append(o.nullFields, "UnhealthyDuration") + } + return o +} + +func (o Scheduling) MarshalJSON() ([]byte, error) { + type noMethod Scheduling + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *Scheduling) SetTasks(v []*Tasks) *Scheduling { + if o.Tasks = v; o.Tasks == nil { + o.nullFields = append(o.nullFields, "Tasks") + } + return o +} + +func (o Tasks) MarshalJSON() ([]byte, error) { + type noMethod Tasks + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *Tasks) SetCronExpression(v *string) *Tasks { + if o.CronExpression = v; o.CronExpression == nil { + o.nullFields = append(o.nullFields, "CronExpression") + } + return o +} + +func (o *Tasks) SetIsEnabled(v *bool) *Tasks { + if o.IsEnabled = v; o.IsEnabled == nil { + o.nullFields = append(o.nullFields, "IsEnabled") + } + return o +} + +func (o *Tasks) SetScaleMaxCapacity(v *int) *Tasks { + if o.ScaleMaxCapacity = v; o.ScaleMaxCapacity == nil { + o.nullFields = append(o.nullFields, "ScaleMaxCapacity") + } + return o +} + +func (o *Tasks) SetScaleMinCapacity(v *int) *Tasks { + if o.ScaleMinCapacity = v; o.ScaleMinCapacity == nil { + o.nullFields = append(o.nullFields, "ScaleMinCapacity") + } + return o +} + +func (o *Tasks) SetScaleTargetCapacity(v *int) *Tasks { + if o.ScaleTargetCapacity = v; o.ScaleTargetCapacity == nil { + o.nullFields = append(o.nullFields, "ScaleTargetCapacity") + } + return o +} + +func (o *Tasks) SetType(v *string) *Tasks { + if o.Type = v; o.Type == nil { + o.nullFields = append(o.nullFields, "Type") + } + return o +} + +func (o *Tasks) SetAdjustment(v *int) *Tasks { + if o.Adjustment = v; o.Adjustment == nil { + o.nullFields = append(o.nullFields, "Adjustment") + } + return o +} + +func (o *Tasks) SetAdjustmentPercentage(v *int) *Tasks { + if o.AdjustmentPercentage = v; o.AdjustmentPercentage == nil { + o.nullFields = append(o.nullFields, "AdjustmentPercentage") + } + return o +} + +func (o *Tasks) SetBatchSizePercentage(v *int) *Tasks { + if o.BatchSizePercentage = v; o.BatchSizePercentage == nil { + o.nullFields = append(o.nullFields, "BatchSizePercentage") + } + return o +} + +func (o *Tasks) SetGracePeriod(v *int) *Tasks { + if o.GracePeriod = v; o.GracePeriod == nil { + o.nullFields = append(o.nullFields, "GracePeriod") + } + return o +} + +func (o DataDisks) MarshalJSON() ([]byte, error) { + type noMethod DataDisks + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *DataDisks) SetLun(v *int) *DataDisks { + if o.Lun = v; o.Lun == nil { + o.nullFields = append(o.nullFields, "Lun") + } + return o +} + +func (o *DataDisks) SetSizeGB(v *int) *DataDisks { + if o.SizeGB = v; o.SizeGB == nil { + o.nullFields = append(o.nullFields, "SizeGB") + } + return o +} + +func (o *DataDisks) SetType(v *string) *DataDisks { + if o.Type = v; o.Type == nil { + o.nullFields = append(o.nullFields, "Type") + } + return o +} + +func (o OsDisk) MarshalJSON() ([]byte, error) { + type noMethod OsDisk + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *OsDisk) SetSizeGB(v *int) *OsDisk { + if o.SizeGB = v; o.SizeGB == nil { + o.nullFields = append(o.nullFields, "SizeGB") + } + return o +} + +func (o *OsDisk) SetType(v *string) *OsDisk { + if o.Type = v; o.Type == nil { + o.nullFields = append(o.nullFields, "Type") + } + return o +} + +func (o BootDiagnostics) MarshalJSON() ([]byte, error) { + type noMethod BootDiagnostics + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *BootDiagnostics) SetStorageUri(v *string) *BootDiagnostics { + if o.StorageUri = v; o.StorageUri == nil { + o.nullFields = append(o.nullFields, "StorageUri") + } + return o +} + +func (o *BootDiagnostics) SetIsEnabled(v *bool) *BootDiagnostics { + if o.IsEnabled = v; o.IsEnabled == nil { + o.nullFields = append(o.nullFields, "IsEnabled") + } + return o +} + +func (o *BootDiagnostics) SetType(v *string) *BootDiagnostics { + if o.Type = v; o.Type == nil { + o.nullFields = append(o.nullFields, "Type") + } + return o +} + +func (o ProximityPlacementGroups) MarshalJSON() ([]byte, error) { + type noMethod ProximityPlacementGroups + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *ProximityPlacementGroups) SetName(v *string) *ProximityPlacementGroups { + if o.Name = v; o.Name == nil { + o.nullFields = append(o.nullFields, "Name") + } + return o +} + +func (o *ProximityPlacementGroups) SetResourceGroupName(v *string) *ProximityPlacementGroups { + if o.ResourceGroupName = v; o.ResourceGroupName == nil { + o.nullFields = append(o.nullFields, "ResourceGroupName") + } + return o +} + +func (o Secrets) MarshalJSON() ([]byte, error) { + type noMethod Secrets + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *Secrets) SetSourceVault(v *SourceVault) *Secrets { + if o.SourceVault = v; o.SourceVault == nil { + o.nullFields = append(o.nullFields, "SourceVault") + } + return o +} + +func (o *Secrets) SetVaultCertificates(v []*VaultCertificates) *Secrets { + if o.VaultCertificates = v; o.VaultCertificates == nil { + o.nullFields = append(o.nullFields, "VaultCertificates") + } + return o +} + +func (o Security) MarshalJSON() ([]byte, error) { + type noMethod Security + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *Security) SetConfidentialOsDiskEncryption(v *bool) *Security { + if o.ConfidentialOsDiskEncryption = v; o.ConfidentialOsDiskEncryption == nil { + o.nullFields = append(o.nullFields, "ConfidentialOsDiskEncryption") + } + return o +} + +func (o *Security) SetSecureBootEnabled(v *bool) *Security { + if o.SecureBootEnabled = v; o.SecureBootEnabled == nil { + o.nullFields = append(o.nullFields, "SecureBootEnabled") + } + return o +} + +func (o *Security) SetSecurityType(v *string) *Security { + if o.SecurityType = v; o.SecurityType == nil { + o.nullFields = append(o.nullFields, "SecurityType") + } + return o +} + +func (o *Security) SetVTpmEnabled(v *bool) *Security { + if o.VTpmEnabled = v; o.VTpmEnabled == nil { + o.nullFields = append(o.nullFields, "VTpmEnabled") + } + return o +} + +func (o SourceVault) MarshalJSON() ([]byte, error) { + type noMethod SourceVault + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *SourceVault) SetName(v *string) *SourceVault { + if o.Name = v; o.Name == nil { + o.nullFields = append(o.nullFields, "Name") + } + return o +} + +func (o *SourceVault) SetResourceGroupName(v *string) *SourceVault { + if o.ResourceGroupName = v; o.ResourceGroupName == nil { + o.nullFields = append(o.nullFields, "ResourceGroupName") + } + return o +} + +func (o VaultCertificates) MarshalJSON() ([]byte, error) { + type noMethod VaultCertificates + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *VaultCertificates) SetCertificateStore(v *string) *VaultCertificates { + if o.CertificateStore = v; o.CertificateStore == nil { + o.nullFields = append(o.nullFields, "CertificateStore") + } + return o +} + +func (o *VaultCertificates) SetCertificateUrl(v *string) *VaultCertificates { + if o.CertificateUrl = v; o.CertificateUrl == nil { + o.nullFields = append(o.nullFields, "CertificateUrl") + } + return o +} + +func (o PublicIps) MarshalJSON() ([]byte, error) { + type noMethod PublicIps + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *PublicIps) SetName(v *string) *PublicIps { + if o.Name = v; o.Name == nil { + o.nullFields = append(o.nullFields, "Name") + } + return o +} + +func (o *PublicIps) SetResourceGroupName(v *string) *PublicIps { + if o.ResourceGroupName = v; o.ResourceGroupName == nil { + o.nullFields = append(o.nullFields, "ResourceGroupName") + } + return o +} + +func (o SecurityGroup) MarshalJSON() ([]byte, error) { + type noMethod SecurityGroup + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *SecurityGroup) SetName(v *string) *SecurityGroup { + if o.Name = v; o.Name == nil { + o.nullFields = append(o.nullFields, "Name") + } + return o +} + +func (o *SecurityGroup) SetResourceGroupName(v *string) *SecurityGroup { + if o.ResourceGroupName = v; o.ResourceGroupName == nil { + o.nullFields = append(o.nullFields, "ResourceGroupName") + } + return o +} diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/gcp/gcp.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/gcp/gcp.go index 19384b6a98..9fad6ee185 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/gcp/gcp.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/gcp/gcp.go @@ -371,11 +371,13 @@ type ScalingPolicy struct { // Strategy defines the strategy attributes of a Group. type Strategy struct { - DrainingTimeout *int `json:"drainingTimeout,omitempty"` - FallbackToOnDemand *bool `json:"fallbackToOd,omitempty"` - PreemptiblePercentage *int `json:"preemptiblePercentage,omitempty"` - OnDemandCount *int `json:"onDemandCount,omitempty"` - ProvisioningModel *string `json:"provisioningModel,omitempty"` + DrainingTimeout *int `json:"drainingTimeout,omitempty"` + FallbackToOnDemand *bool `json:"fallbackToOd,omitempty"` + PreemptiblePercentage *int `json:"preemptiblePercentage,omitempty"` + OnDemandCount *int `json:"onDemandCount,omitempty"` + ProvisioningModel *string `json:"provisioningModel,omitempty"` + RevertToPreemptible *RevertToPreemptible `json:"revertToPreemptible,omitempty"` + OptimizationWindows []string `json:"optimizationWindows,omitempty"` forceSendFields []string nullFields []string @@ -537,6 +539,13 @@ type UpdateGroupOutput struct { Group *Group `json:"group,omitempty"` } +type RevertToPreemptible struct { + PerformAt *string `json:"performAt,omitempty"` + + forceSendFields []string + nullFields []string +} + // endregion // region API Operations @@ -2142,6 +2151,12 @@ func (o Strategy) MarshalJSON() ([]byte, error) { return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) } +func (o RevertToPreemptible) MarshalJSON() ([]byte, error) { + type noMethod RevertToPreemptible + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + // SetDrainingTimeout sets the time to keep an instance alive after detaching it from the group func (o *Strategy) SetDrainingTimeout(v *int) *Strategy { if o.DrainingTimeout = v; o.DrainingTimeout == nil { @@ -2181,4 +2196,25 @@ func (o *Strategy) SetProvisioningModel(v *string) *Strategy { return o } +func (o *Strategy) SetRevertToPreemptible(v *RevertToPreemptible) *Strategy { + if o.RevertToPreemptible = v; o.RevertToPreemptible == nil { + o.nullFields = append(o.nullFields, "RevertToPreemptible") + } + return o +} + +func (o *RevertToPreemptible) SetPerformAt(v *string) *RevertToPreemptible { + if o.PerformAt = v; o.PerformAt == nil { + o.nullFields = append(o.nullFields, "PerformAt") + } + return o +} + +func (o *Strategy) SetOptimizationWindows(v []string) *Strategy { + if o.OptimizationWindows = v; o.OptimizationWindows == nil { + o.nullFields = append(o.nullFields, "OptimizationWindows") + } + return o +} + // endregion diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/ocean.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/ocean.go index 9df16a3a55..8bd5c37e37 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/ocean.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/ocean.go @@ -2,9 +2,9 @@ package ocean import ( "github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws" - "github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure" "github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure_np" "github.com/spotinst/spotinst-sdk-go/service/ocean/providers/gcp" + "github.com/spotinst/spotinst-sdk-go/service/ocean/right_sizing" "github.com/spotinst/spotinst-sdk-go/service/ocean/spark" "github.com/spotinst/spotinst-sdk-go/spotinst" "github.com/spotinst/spotinst-sdk-go/spotinst/client" @@ -17,9 +17,9 @@ import ( type Service interface { CloudProviderAWS() aws.Service CloudProviderGCP() gcp.Service - CloudProviderAzure() azure.Service Spark() spark.Service CloudProviderAzureNP() azure_np.Service + RightSizing() right_sizing.Service } type ServiceOp struct { @@ -50,12 +50,6 @@ func (s *ServiceOp) CloudProviderGCP() gcp.Service { } } -func (s *ServiceOp) CloudProviderAzure() azure.Service { - return &azure.ServiceOp{ - Client: s.Client, - } -} - func (s *ServiceOp) Spark() spark.Service { return &spark.ServiceOp{ Client: s.Client, @@ -67,3 +61,9 @@ func (s *ServiceOp) CloudProviderAzureNP() azure_np.Service { Client: s.Client, } } + +func (s *ServiceOp) RightSizing() right_sizing.Service { + return &right_sizing.ServiceOp{ + Client: s.Client, + } +} diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/cluster.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/cluster.go index d7956e82d2..3e869ab36a 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/cluster.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/cluster.go @@ -119,9 +119,48 @@ type ShutdownHours struct { } type Task struct { - IsEnabled *bool `json:"isEnabled,omitempty"` - Type *string `json:"taskType,omitempty"` - CronExpression *string `json:"cronExpression,omitempty"` + IsEnabled *bool `json:"isEnabled,omitempty"` + Type *string `json:"taskType,omitempty"` + CronExpression *string `json:"cronExpression,omitempty"` + Parameter *Parameter `json:"parameters,omitempty"` + + forceSendFields []string + nullFields []string +} + +type Parameter struct { + AmiAutoUpdate *AmiAutoUpdate `json:"amiAutoUpdate,omitempty"` + ClusterRoll *ParameterClusterRoll `json:"clusterRoll,omitempty"` + + forceSendFields []string + nullFields []string +} + +type AmiAutoUpdate struct { + ApplyRoll *bool `json:"applyRoll,omitempty"` + AmiAutoUpdateClusterRoll *AmiAutoUpdateClusterRoll `json:"clusterRoll,omitempty"` + MinorVersion *bool `json:"minorVersion,omitempty"` + Patch *bool `json:"patch,omitempty"` + + forceSendFields []string + nullFields []string +} + +type AmiAutoUpdateClusterRoll struct { + BatchMinHealthyPercentage *int `json:"batchMinHealthyPercentage,omitempty"` + BatchSizePercentage *int `json:"batchSizePercentage,omitempty"` + Comment *string `json:"comment,omitempty"` + RespectPdb *bool `json:"respectPdb,omitempty"` + + forceSendFields []string + nullFields []string +} + +type ParameterClusterRoll struct { + BatchMinHealthyPercentage *int `json:"batchMinHealthyPercentage,omitempty"` + BatchSizePercentage *int `json:"batchSizePercentage,omitempty"` + Comment *string `json:"comment,omitempty"` + RespectPdb *bool `json:"respectPdb,omitempty"` forceSendFields []string nullFields []string @@ -162,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 @@ -235,8 +275,16 @@ type AutoScalerResourceLimits struct { } type AutoScalerDown struct { - EvaluationPeriods *int `json:"evaluationPeriods,omitempty"` - MaxScaleDownPercentage *float64 `json:"maxScaleDownPercentage,omitempty"` + EvaluationPeriods *int `json:"evaluationPeriods,omitempty"` + MaxScaleDownPercentage *float64 `json:"maxScaleDownPercentage,omitempty"` + AggressiveScaleDown *AggressiveScaleDown `json:"aggressiveScaleDown,omitempty"` + + forceSendFields []string + nullFields []string +} + +type AggressiveScaleDown struct { + IsEnabled *bool `json:"isEnabled,omitempty"` forceSendFields []string nullFields []string @@ -1349,6 +1397,125 @@ func (o *Task) SetCronExpression(v *string) *Task { // endregion +// region Parameter + +func (o *Task) SetParameter(v *Parameter) *Task { + if o.Parameter = v; o.Parameter == nil { + o.nullFields = append(o.nullFields, "Parameter") + } + return o +} + +func (o *Parameter) SetAmiAutoUpdate(v *AmiAutoUpdate) *Parameter { + if o.AmiAutoUpdate = v; o.AmiAutoUpdate == nil { + o.nullFields = append(o.nullFields, "AmiAutoUpdate") + } + return o +} + +func (o *Parameter) SetClusterRoll(v *ParameterClusterRoll) *Parameter { + if o.ClusterRoll = v; o.ClusterRoll == nil { + o.nullFields = append(o.nullFields, "ClusterRoll") + } + return o +} + +// region AmiAutoUpdate + +func (o *AmiAutoUpdate) SetApplyRoll(v *bool) *AmiAutoUpdate { + if o.ApplyRoll = v; o.ApplyRoll == nil { + o.nullFields = append(o.nullFields, "ApplyRoll") + } + return o +} + +func (o *AmiAutoUpdate) SetClusterRoll(v *AmiAutoUpdateClusterRoll) *AmiAutoUpdate { + if o.AmiAutoUpdateClusterRoll = v; o.AmiAutoUpdateClusterRoll == nil { + o.nullFields = append(o.nullFields, "ClusterRoll") + } + return o +} + +func (o *AmiAutoUpdate) SetMinorVersion(v *bool) *AmiAutoUpdate { + if o.MinorVersion = v; o.MinorVersion == nil { + o.nullFields = append(o.nullFields, "MinorVersion") + } + return o +} + +func (o *AmiAutoUpdate) SetPatch(v *bool) *AmiAutoUpdate { + if o.Patch = v; o.Patch == nil { + o.nullFields = append(o.nullFields, "Patch") + } + return o +} + +// endregion + +// region ParameterClusterRoll + +func (o *ParameterClusterRoll) SetBatchMinHealthyPercentage(v *int) *ParameterClusterRoll { + if o.BatchMinHealthyPercentage = v; o.BatchMinHealthyPercentage == nil { + o.nullFields = append(o.nullFields, "BatchMinHealthyPercentage") + } + return o +} + +func (o *ParameterClusterRoll) SetBatchSizePercentage(v *int) *ParameterClusterRoll { + if o.BatchSizePercentage = v; o.BatchSizePercentage == nil { + o.nullFields = append(o.nullFields, "BatchSizePercentage") + } + return o +} + +func (o *ParameterClusterRoll) SetComment(v *string) *ParameterClusterRoll { + if o.Comment = v; o.Comment == nil { + o.nullFields = append(o.nullFields, "Comment") + } + return o +} + +func (o *ParameterClusterRoll) SetRespectPdb(v *bool) *ParameterClusterRoll { + if o.RespectPdb = v; o.RespectPdb == nil { + o.nullFields = append(o.nullFields, "RespectPdb") + } + return o +} + +// endregion + +// region ParameterClusterRoll + +func (o *AmiAutoUpdateClusterRoll) SetBatchMinHealthyPercentage(v *int) *AmiAutoUpdateClusterRoll { + if o.BatchMinHealthyPercentage = v; o.BatchMinHealthyPercentage == nil { + o.nullFields = append(o.nullFields, "BatchMinHealthyPercentage") + } + return o +} + +func (o *AmiAutoUpdateClusterRoll) SetBatchSizePercentage(v *int) *AmiAutoUpdateClusterRoll { + if o.BatchSizePercentage = v; o.BatchSizePercentage == nil { + o.nullFields = append(o.nullFields, "BatchSizePercentage") + } + return o +} + +func (o *AmiAutoUpdateClusterRoll) SetComment(v *string) *AmiAutoUpdateClusterRoll { + if o.Comment = v; o.Comment == nil { + o.nullFields = append(o.nullFields, "Comment") + } + return o +} + +func (o *AmiAutoUpdateClusterRoll) SetRespectPdb(v *bool) *AmiAutoUpdateClusterRoll { + if o.RespectPdb = v; o.RespectPdb == nil { + o.nullFields = append(o.nullFields, "RespectPdb") + } + return o +} + +// endregion + // region ShutdownHours func (o ShutdownHours) MarshalJSON() ([]byte, error) { @@ -1517,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 @@ -1725,8 +1899,28 @@ func (o *AutoScalerDown) SetMaxScaleDownPercentage(v *float64) *AutoScalerDown { return o } +func (o *AutoScalerDown) SetAggressiveScaleDown(v *AggressiveScaleDown) *AutoScalerDown { + if o.AggressiveScaleDown = v; o.AggressiveScaleDown == nil { + o.nullFields = append(o.nullFields, "AggressiveScaleDown") + } + return o +} + // endregion +func (o AggressiveScaleDown) MarshalJSON() ([]byte, error) { + type noMethod AggressiveScaleDown + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *AggressiveScaleDown) SetIsEnabled(v *bool) *AggressiveScaleDown { + if o.IsEnabled = v; o.IsEnabled == nil { + o.nullFields = append(o.nullFields, "IsEnabled") + } + return o +} + // region Roll func (o Roll) MarshalJSON() ([]byte, error) { @@ -2078,6 +2272,7 @@ type ClusterEBS struct { VolumeSize *int `json:"volumeSize,omitempty"` Throughput *int `json:"throughput,omitempty"` DynamicVolumeSize *ClusterDynamicVolumeSize `json:"dynamicVolumeSize,omitempty"` + DynamicIops *ClusterDynamicIops `json:"dynamicIops,omitempty"` forceSendFields []string nullFields []string @@ -2091,6 +2286,15 @@ type ClusterDynamicVolumeSize struct { nullFields []string } +type ClusterDynamicIops struct { + BaseSize *int `json:"baseSize,omitempty"` + SizePerResourceUnit *int `json:"sizePerResourceUnit,omitempty"` + Resource *string `json:"resource,omitempty"` + + forceSendFields []string + nullFields []string +} + // region BlockDeviceMapping func (o ClusterBlockDeviceMappings) MarshalJSON() ([]byte, error) { @@ -2186,6 +2390,13 @@ func (o *ClusterEBS) SetThroughput(v *int) *ClusterEBS { return o } +func (o *ClusterEBS) SetDynamicIops(v *ClusterDynamicIops) *ClusterEBS { + if o.DynamicIops = v; o.DynamicIops == nil { + o.nullFields = append(o.nullFields, "DynamicIops") + } + return o +} + // endregion // region DynamicVolumeSize @@ -2219,6 +2430,37 @@ func (o *ClusterDynamicVolumeSize) SetSizePerResourceUnit(v *int) *ClusterDynami // endregion +// region DynamicIops + +func (o ClusterDynamicIops) MarshalJSON() ([]byte, error) { + type noMethod ClusterDynamicIops + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *ClusterDynamicIops) SetBaseSize(v *int) *ClusterDynamicIops { + if o.BaseSize = v; o.BaseSize == nil { + o.nullFields = append(o.nullFields, "BaseSize") + } + return o +} + +func (o *ClusterDynamicIops) SetResource(v *string) *ClusterDynamicIops { + if o.Resource = v; o.Resource == nil { + o.nullFields = append(o.nullFields, "Resource") + } + return o +} + +func (o *ClusterDynamicIops) SetSizePerResourceUnit(v *int) *ClusterDynamicIops { + if o.SizePerResourceUnit = v; o.SizePerResourceUnit == nil { + o.nullFields = append(o.nullFields, "SizePerResourceUnit") + } + return o +} + +// endregion + // region ResourceTagSpecification func (o ResourceTagSpecification) MarshalJSON() ([]byte, error) { diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/clusternodes.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/clusternodes.go new file mode 100644 index 0000000000..58d1a19e77 --- /dev/null +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/clusternodes.go @@ -0,0 +1,123 @@ +package aws + +import ( + "context" + "encoding/json" + "github.com/spotinst/spotinst-sdk-go/spotinst" + "github.com/spotinst/spotinst-sdk-go/spotinst/client" + "github.com/spotinst/spotinst-sdk-go/spotinst/util/uritemplates" + "io/ioutil" + "net/http" + "time" +) + +type ClusterNodes struct { + InstanceId *string `json:"instanceId,omitempty"` + InstanceType *string `json:"instanceType,omitempty"` + AvailabilityZone *string `json:"availabilityZone,omitempty"` + LaunchSpecId *string `json:"launchSpecId,omitempty"` + LaunchSpecName *string `json:"launchSpecName,omitempty"` + LifeCycle *string `json:"lifeCycle,omitempty"` + PublicIp *string `json:"publicIp,omitempty"` + NodeName *string `json:"nodeName,omitempty"` + RegistrationStatus *string `json:"registrationStatus,omitempty"` + WorkloadRequestedMilliCpu *int `json:"workloadRequestedMilliCpu,omitempty"` + WorkloadRequestedMemoryInMiB *int `json:"workloadRequestedMemoryInMiB,omitempty"` + WorkloadRequestedGpu *int `json:"workloadRequestedGpu,omitempty"` + HeadroomRequestedMilliCpu *int `json:"headroomRequestedMilliCpu,omitempty"` + HeadroomRequestedMemoryInMiB *int `json:"headroomRequestedMemoryInMiB,omitempty"` + HeadroomRequestedGpu *int `json:"headroomRequestedGpu,omitempty"` + AllocatableMilliCpu *int `json:"allocatableMilliCpu,omitempty"` + AllocatableMemoryInMiB *float64 `json:"allocatableMemoryInMiB,omitempty"` + AllocatableGpu *int `json:"allocatableGpu,omitempty"` + + // Read-only fields. + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // forceSendFields is a list of field names (e.g. "Keys") to + // unconditionally include in API requests. By default, fields with + // empty values are omitted from API requests. However, any non-pointer, + // non-interface field appearing in ForceSendFields will be sent to the + // server regardless of whether the field is empty or not. This may be + // used to include empty fields in Patch requests. + forceSendFields []string + + // nullFields is a list of field names (e.g. "Keys") to include in API + // requests with the JSON null value. By default, fields with empty + // values are omitted from API requests. However, any field with an + // empty value appearing in NullFields will be sent to the server as + // null. It is an error if a field in this list has a non-empty value. + // This may be used to include null fields in Patch requests. + nullFields []string +} +type ReadClusterNodeInput struct { + ClusterID *string `json:"clusterId,omitempty"` + LaunchSpecId *string `json:"launchSpecId,omitempty"` + InstanceId *string `json:"instanceId,omitempty"` +} + +type ReadClusterNodeOutput struct { + ClusterNode []*ClusterNodes `json:"clusterNode,omitempty"` +} + +func (s *ServiceOp) ReadClusterNodes(ctx context.Context, input *ReadClusterNodeInput) (*ReadClusterNodeOutput, error) { + path, err := uritemplates.Expand("/ocean/aws/k8s/cluster/{oceanClusterId}/nodes", uritemplates.Values{ + "oceanClusterId": spotinst.StringValue(input.ClusterID), + }) + if err != nil { + return nil, err + } + r := client.NewRequest(http.MethodGet, path) + if input.LaunchSpecId != nil { + r.Params["launchSpecId"] = []string{spotinst.StringValue(input.LaunchSpecId)} + } + if input.InstanceId != nil { + r.Params["instanceId"] = []string{spotinst.StringValue(input.InstanceId)} + } + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + gs, err := nodesFromHttpResponse(resp) + if err != nil { + return nil, err + } + + return &ReadClusterNodeOutput{ClusterNode: gs}, nil +} + +func nodesFromHttpResponse(resp *http.Response) ([]*ClusterNodes, error) { + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + return nodesFromJSON(body) +} + +func nodesFromJSON(in []byte) ([]*ClusterNodes, error) { + var rw client.Response + if err := json.Unmarshal(in, &rw); err != nil { + return nil, err + } + out := make([]*ClusterNodes, len(rw.Response.Items)) + if len(out) == 0 { + return out, nil + } + for i, rb := range rw.Response.Items { + b, err := nodeFromJSON(rb) + if err != nil { + return nil, err + } + out[i] = b + } + return out, nil +} + +func nodeFromJSON(in []byte) (*ClusterNodes, error) { + b := new(ClusterNodes) + if err := json.Unmarshal(in, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/launchspec.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/launchspec.go index 8cc9996f80..30a6b743a3 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/launchspec.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/launchspec.go @@ -31,6 +31,7 @@ type LaunchSpec struct { AutoScale *AutoScale `json:"autoScale,omitempty"` ElasticIPPool *ElasticIPPool `json:"elasticIpPool,omitempty"` BlockDeviceMappings []*BlockDeviceMapping `json:"blockDeviceMappings,omitempty"` + EphemeralStorage *EphemeralStorage `json:"ephemeralStorage,omitempty"` Labels []*Label `json:"labels,omitempty"` Taints []*Taint `json:"taints,omitempty"` Tags []*Tag `json:"tags,omitempty"` @@ -39,6 +40,8 @@ type LaunchSpec struct { LaunchSpecScheduling *LaunchSpecScheduling `json:"scheduling,omitempty"` InstanceMetadataOptions *LaunchspecInstanceMetadataOptions `json:"instanceMetadataOptions,omitempty"` Images []*Images `json:"images,omitempty"` + InstanceTypesFilters *InstanceTypesFilters `json:"instanceTypesFilters,omitempty"` + PreferredOnDemandTypes []string `json:"preferredOnDemandTypes,omitempty"` // Read-only fields. CreatedAt *time.Time `json:"createdAt,omitempty"` @@ -218,7 +221,10 @@ type TagSelector struct { } type LaunchSpecStrategy struct { - SpotPercentage *int `json:"spotPercentage,omitempty"` + SpotPercentage *int `json:"spotPercentage,omitempty"` + DrainingTimeout *int `json:"drainingTimeout,omitempty"` + UtilizeCommitments *bool `json:"utilizeCommitments,omitempty"` + UtilizeReservedInstances *bool `json:"utilizeReservedInstances,omitempty"` forceSendFields []string nullFields []string @@ -274,6 +280,37 @@ type Images struct { nullFields []string } +type InstanceTypesFilters struct { + Categories []string `json:"categories,omitempty"` + DiskTypes []string `json:"diskTypes,omitempty"` + ExcludeFamilies []string `json:"excludeFamilies,omitempty"` + ExcludeMetal *bool `json:"excludeMetal,omitempty"` + Hypervisor []string `json:"hypervisor,omitempty"` + IncludeFamilies []string `json:"includeFamilies,omitempty"` + IsEnaSupported *bool `json:"isEnaSupported,omitempty"` + MaxGpu *int `json:"maxGpu,omitempty"` + MaxMemoryGiB *float64 `json:"maxMemoryGiB,omitempty"` + MaxNetworkPerformance *int `json:"maxNetworkPerformance,omitempty"` + MaxVcpu *int `json:"maxVcpu,omitempty"` + MinEnis *int `json:"minEnis,omitempty"` + MinGpu *int `json:"minGpu,omitempty"` + MinMemoryGiB *float64 `json:"minMemoryGiB,omitempty"` + MinNetworkPerformance *int `json:"minNetworkPerformance,omitempty"` + MinVcpu *int `json:"minVcpu,omitempty"` + RootDeviceTypes []string `json:"rootDeviceTypes,omitempty"` + VirtualizationTypes []string `json:"virtualizationTypes,omitempty"` + + forceSendFields []string + nullFields []string +} + +type EphemeralStorage struct { + DeviceName *string `json:"deviceName,omitempty"` + + forceSendFields []string + nullFields []string +} + type ListLaunchSpecsInput struct { OceanID *string `json:"oceanId,omitempty"` } @@ -558,6 +595,13 @@ func (o *LaunchSpec) SetPreferredSpotTypes(v []string) *LaunchSpec { return o } +func (o *LaunchSpec) SetPreferredOnDemandTypes(v []string) *LaunchSpec { + if o.PreferredOnDemandTypes = v; o.PreferredOnDemandTypes == nil { + o.nullFields = append(o.nullFields, "PreferredOnDemandTypes") + } + return o +} + func (o *LaunchSpec) SetRootVolumeSize(v *int) *LaunchSpec { if o.RootVolumeSize = v; o.RootVolumeSize == nil { o.nullFields = append(o.nullFields, "RootVolumeSize") @@ -648,6 +692,18 @@ func (o *LaunchSpec) SetScheduling(v *LaunchSpecScheduling) *LaunchSpec { } return o } +func (o *LaunchSpec) SetInstanceTypesFilters(v *InstanceTypesFilters) *LaunchSpec { + if o.InstanceTypesFilters = v; o.InstanceTypesFilters == nil { + o.nullFields = append(o.nullFields, "InstanceTypesFilters") + } + return o +} +func (o *LaunchSpec) SetEphemeralStorage(v *EphemeralStorage) *LaunchSpec { + if o.EphemeralStorage = v; o.EphemeralStorage == nil { + o.nullFields = append(o.nullFields, "EphemeralStorage") + } + return o +} // endregion @@ -990,6 +1046,27 @@ func (o *LaunchSpecStrategy) SetSpotPercentage(v *int) *LaunchSpecStrategy { return o } +func (o *LaunchSpecStrategy) SetDrainingTimeout(v *int) *LaunchSpecStrategy { + if o.DrainingTimeout = v; o.DrainingTimeout == nil { + o.nullFields = append(o.nullFields, "DrainingTimeout") + } + return o +} + +func (o *LaunchSpecStrategy) SetUtilizeCommitments(v *bool) *LaunchSpecStrategy { + if o.UtilizeCommitments = v; o.UtilizeCommitments == nil { + o.nullFields = append(o.nullFields, "UtilizeCommitments") + } + return o +} + +func (o *LaunchSpecStrategy) SetUtilizeReservedInstances(v *bool) *LaunchSpecStrategy { + if o.UtilizeReservedInstances = v; o.UtilizeReservedInstances == nil { + o.nullFields = append(o.nullFields, "UtilizeReservedInstances") + } + return o +} + // endregion //region Scheduling @@ -1150,3 +1227,156 @@ func (o *Images) SetImageId(v *string) *Images { } // endregion + +// region InstanceTypesFilters + +func (o InstanceTypesFilters) MarshalJSON() ([]byte, error) { + type noMethod InstanceTypesFilters + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *InstanceTypesFilters) SetCategories(v []string) *InstanceTypesFilters { + if o.Categories = v; o.Categories == nil { + o.nullFields = append(o.nullFields, "Categories") + } + return o +} + +func (o *InstanceTypesFilters) SetDiskTypes(v []string) *InstanceTypesFilters { + if o.DiskTypes = v; o.DiskTypes == nil { + o.nullFields = append(o.nullFields, "DiskTypes") + } + return o +} + +func (o *InstanceTypesFilters) SetExcludeFamilies(v []string) *InstanceTypesFilters { + if o.ExcludeFamilies = v; o.ExcludeFamilies == nil { + o.nullFields = append(o.nullFields, "ExcludeFamilies") + } + return o +} + +func (o *InstanceTypesFilters) SetExcludeMetal(v *bool) *InstanceTypesFilters { + if o.ExcludeMetal = v; o.ExcludeMetal == nil { + o.nullFields = append(o.nullFields, "ExcludeMetal") + } + return o +} + +func (o *InstanceTypesFilters) SetHypervisor(v []string) *InstanceTypesFilters { + if o.Hypervisor = v; o.Hypervisor == nil { + o.nullFields = append(o.nullFields, "Hypervisor") + } + return o +} + +func (o *InstanceTypesFilters) SetIncludeFamilies(v []string) *InstanceTypesFilters { + if o.IncludeFamilies = v; o.IncludeFamilies == nil { + o.nullFields = append(o.nullFields, "IncludeFamilies") + } + return o +} + +func (o *InstanceTypesFilters) SetIsEnaSupported(v *bool) *InstanceTypesFilters { + if o.IsEnaSupported = v; o.IsEnaSupported == nil { + o.nullFields = append(o.nullFields, "IsEnaSupported") + } + return o +} + +func (o *InstanceTypesFilters) SetMaxGpu(v *int) *InstanceTypesFilters { + if o.MaxGpu = v; o.MaxGpu == nil { + o.nullFields = append(o.nullFields, "MaxGpu") + } + return o +} + +func (o *InstanceTypesFilters) SetMaxMemoryGiB(v *float64) *InstanceTypesFilters { + if o.MaxMemoryGiB = v; o.MaxMemoryGiB == nil { + o.nullFields = append(o.nullFields, "MaxMemoryGiB") + } + return o +} + +func (o *InstanceTypesFilters) SetMaxNetworkPerformance(v *int) *InstanceTypesFilters { + if o.MaxNetworkPerformance = v; o.MaxNetworkPerformance == nil { + o.nullFields = append(o.nullFields, "MaxNetworkPerformance") + } + return o +} + +func (o *InstanceTypesFilters) SetMaxVcpu(v *int) *InstanceTypesFilters { + if o.MaxVcpu = v; o.MaxVcpu == nil { + o.nullFields = append(o.nullFields, "MaxVcpu") + } + return o +} + +func (o *InstanceTypesFilters) SetMinEnis(v *int) *InstanceTypesFilters { + if o.MinEnis = v; o.MinEnis == nil { + o.nullFields = append(o.nullFields, "MinEnis") + } + return o +} + +func (o *InstanceTypesFilters) SetMinGpu(v *int) *InstanceTypesFilters { + if o.MinGpu = v; o.MinGpu == nil { + o.nullFields = append(o.nullFields, "MinGpu") + } + return o +} + +func (o *InstanceTypesFilters) SetMinMemoryGiB(v *float64) *InstanceTypesFilters { + if o.MinMemoryGiB = v; o.MinMemoryGiB == nil { + o.nullFields = append(o.nullFields, "MinMemoryGiB") + } + return o +} + +func (o *InstanceTypesFilters) SetMinNetworkPerformance(v *int) *InstanceTypesFilters { + if o.MinNetworkPerformance = v; o.MinNetworkPerformance == nil { + o.nullFields = append(o.nullFields, "MinNetworkPerformance") + } + return o +} + +func (o *InstanceTypesFilters) SetMinVcpu(v *int) *InstanceTypesFilters { + if o.MinVcpu = v; o.MinVcpu == nil { + o.nullFields = append(o.nullFields, "MinVcpu") + } + return o +} + +func (o *InstanceTypesFilters) SetRootDeviceTypes(v []string) *InstanceTypesFilters { + if o.RootDeviceTypes = v; o.RootDeviceTypes == nil { + o.nullFields = append(o.nullFields, "RootDeviceTypes") + } + return o +} + +func (o *InstanceTypesFilters) SetVirtualizationTypes(v []string) *InstanceTypesFilters { + if o.VirtualizationTypes = v; o.VirtualizationTypes == nil { + o.nullFields = append(o.nullFields, "VirtualizationTypes") + } + return o +} + +// endregion + +// region EphemeralStorage + +func (o *EphemeralStorage) SetDeviceName(v *string) *EphemeralStorage { + if o.DeviceName = v; o.DeviceName == nil { + o.nullFields = append(o.nullFields, "DeviceName") + } + return o +} + +func (o EphemeralStorage) MarshalJSON() ([]byte, error) { + type noMethod EphemeralStorage + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +// endregion diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/launchspec_ecs.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/launchspec_ecs.go index 541c07d3ef..7faae6a021 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/launchspec_ecs.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/launchspec_ecs.go @@ -32,6 +32,7 @@ type ECSLaunchSpec struct { SubnetIDs []string `json:"subnetIds,omitempty"` LaunchSpecScheduling *ECSLaunchSpecScheduling `json:"scheduling,omitempty"` InstanceMetadataOptions *ECSLaunchspecInstanceMetadataOptions `json:"instanceMetadataOptions,omitempty"` + Images []*ECSImages `json:"images,omitempty"` // Read-only fields. CreatedAt *time.Time `json:"createdAt,omitempty"` @@ -226,6 +227,33 @@ type DeleteECSLaunchSpecInput struct { LaunchSpecID *string `json:"launchSpecId,omitempty"` } +type ECSImages struct { + ImageId *string `json:"id,omitempty"` + + forceSendFields []string + nullFields []string +} + +func (o *ECSLaunchSpec) SetECSImages(v []*ECSImages) *ECSLaunchSpec { + if o.Images = v; o.Images == nil { + o.nullFields = append(o.nullFields, "Images") + } + return o +} + +func (o ECSImages) MarshalJSON() ([]byte, error) { + type noMethod ECSImages + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *ECSImages) SetImageId(v *string) *ECSImages { + if o.ImageId = v; o.ImageId == nil { + o.nullFields = append(o.nullFields, "ImageId") + } + return o +} + type DeleteECSLaunchSpecOutput struct{} func ecsLaunchSpecFromJSON(in []byte) (*ECSLaunchSpec, error) { diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/loadbalancer.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/loadbalancer.go new file mode 100644 index 0000000000..760e1335c7 --- /dev/null +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/loadbalancer.go @@ -0,0 +1,73 @@ +package aws + +import ( + "context" + "github.com/spotinst/spotinst-sdk-go/spotinst" + "github.com/spotinst/spotinst-sdk-go/spotinst/client" + "github.com/spotinst/spotinst-sdk-go/spotinst/util/uritemplates" + "net/http" +) + +type LoadBalancers struct { + Arn *string `json:"arn,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +type AttachLoadbalancerInput struct { + LoadBalancers []*LoadBalancers `json:"loadBalancers,omitempty"` + ID *string `json:"id,omitempty"` +} + +type AttachLoadbalancerOutput struct{} + +type DetachLoadbalancerInput struct { + LoadBalancers []*LoadBalancers `json:"loadBalancers,omitempty"` + ID *string `json:"id,omitempty"` +} + +type DetachLoadbalancerOutput struct{} + +func (s *ServiceOp) AttachLoadBalancer(ctx context.Context, + input *AttachLoadbalancerInput) (*AttachLoadbalancerOutput, error) { + path, err := uritemplates.Expand("/ocean/aws/k8s/cluster/{oceanClusterId}/loadBalancer/attach", uritemplates.Values{ + "oceanClusterId": spotinst.StringValue(input.ID), + }) + if err != nil { + return nil, err + } + input.ID = nil + + r := client.NewRequest(http.MethodPut, path) + r.Obj = input + + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + return &AttachLoadbalancerOutput{}, nil +} + +func (s *ServiceOp) DetachLoadBalancer(ctx context.Context, + input *DetachLoadbalancerInput) (*DetachLoadbalancerOutput, error) { + path, err := uritemplates.Expand("/ocean/aws/k8s/cluster/{oceanClusterId}/loadBalancer/detach", uritemplates.Values{ + "oceanClusterId": spotinst.StringValue(input.ID), + }) + if err != nil { + return nil, err + } + input.ID = nil + + r := client.NewRequest(http.MethodPut, path) + r.Obj = input + + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + return &DetachLoadbalancerOutput{}, nil +} diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/migrationstatus.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/migrationstatus.go new file mode 100644 index 0000000000..1a4b50f0da --- /dev/null +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/migrationstatus.go @@ -0,0 +1,136 @@ +package aws + +import ( + "context" + "encoding/json" + "github.com/spotinst/spotinst-sdk-go/spotinst" + "github.com/spotinst/spotinst-sdk-go/spotinst/client" + "github.com/spotinst/spotinst-sdk-go/spotinst/util/uritemplates" + "io/ioutil" + "net/http" +) + +type MigrationStatus struct { + ID *string `json:"Id,omitempty"` + OceanId *string `json:"oceanId,omitempty"` + Status *string `json:"status,omitempty"` + NewInstances []*InstanceDetails `json:"newInstances,omitempty"` + OldInstances []*InstanceDetails `json:"oldInstances,omitempty"` + UnscheduledPodIds *string `json:"unscheduledPodIds,omitempty"` + NewUnscheduledPodIds *string `json:"newUnscheduledPodIds,omitempty"` + MigrationConfig *MigrationConfig `json:"migrationConfig,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + ErroredAt *string `json:"erroredAt,omitempty"` + StoppedAt *string `json:"stoppedAt,omitempty"` + CompletedAt *string `json:"completedAt,omitempty"` + + // forceSendFields is a list of field names (e.g. "Keys") to + // unconditionally include in API requests. By default, fields with + // empty values are omitted from API requests. However, any non-pointer, + // non-interface field appearing in ForceSendFields will be sent to the + // server regardless of whether the field is empty or not. This may be + // used to include empty fields in Patch requests. + forceSendFields []string + + // nullFields is a list of field names (e.g. "Keys") to include in API + // requests with the JSON null value. By default, fields with empty + // values are omitted from API requests. However, any field with an + // empty value appearing in NullFields will be sent to the server as + // null. It is an error if a field in this list has a non-empty value. + // This may be used to include null fields in Patch requests. + nullFields []string +} +type MigrationConfig struct { + ShouldTerminateDrainedNodes *bool `json:"shouldTerminateDrainedNodes,omitempty"` + ShouldEvictStandAlonePods *bool `json:"shouldEvictStandAlonePods,omitempty"` + + forceSendFields []string + nullFields []string +} + +type InstanceDetails struct { + InstanceId *string `json:"instanceId,omitempty"` + K8sNodeName *string `json:"k8sNodeName,omitempty"` + AsgName *string `json:"asgName,omitempty"` + State *string `json:"state,omitempty"` + RunningPods *int64 `json:"runningPods,omitempty"` + PodDetails []*PodDetails `json:"podDetails,omitempty"` + + forceSendFields []string + nullFields []string +} + +type PodDetails struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + + forceSendFields []string + nullFields []string +} + +type ReadMigrationStatusInput struct { + ClusterID *string `json:"clusterId,omitempty"` + MigrationID *string `json:"migrationId,omitempty"` +} + +type ReadMigrationStatusOutput struct { + MigrationStatus []*MigrationStatus `json:"migrationStatus,omitempty"` +} + +func (s *ServiceOp) MigrationStatus(ctx context.Context, input *ReadMigrationStatusInput) (*ReadMigrationStatusOutput, error) { + path, err := uritemplates.Expand("/ocean/aws/k8s/cluster/{oceanClusterId}/migration/{migrationId}", uritemplates.Values{ + "oceanClusterId": spotinst.StringValue(input.ClusterID), + "migrationId": spotinst.StringValue(input.MigrationID), + }) + if err != nil { + return nil, err + } + r := client.NewRequest(http.MethodGet, path) + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + gs, err := migrationStatusFromHttpResponse(resp) + if err != nil { + return nil, err + } + + return &ReadMigrationStatusOutput{MigrationStatus: gs}, nil +} + +func migrationStatusFromHttpResponse(resp *http.Response) ([]*MigrationStatus, error) { + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + return migrationStatusFromJSON(body) +} + +func migrationStatusFromJSON(in []byte) ([]*MigrationStatus, error) { + var rw client.Response + if err := json.Unmarshal(in, &rw); err != nil { + return nil, err + } + out := make([]*MigrationStatus, len(rw.Response.Items)) + if len(out) == 0 { + return out, nil + } + for i, rb := range rw.Response.Items { + b, err := statusFromJSON(rb) + if err != nil { + return nil, err + } + out[i] = b + } + return out, nil +} + +func statusFromJSON(in []byte) (*MigrationStatus, error) { + b := new(MigrationStatus) + if err := json.Unmarshal(in, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/migrationsummary.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/migrationsummary.go new file mode 100644 index 0000000000..db7175d0d2 --- /dev/null +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/migrationsummary.go @@ -0,0 +1,97 @@ +package aws + +import ( + "context" + "encoding/json" + "github.com/spotinst/spotinst-sdk-go/spotinst" + "github.com/spotinst/spotinst-sdk-go/spotinst/client" + "github.com/spotinst/spotinst-sdk-go/spotinst/util/uritemplates" + "io/ioutil" + "net/http" +) + +type Migration struct { + ID *string `json:"Id,omitempty"` + State *string `json:"state,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + CompletedAt *string `json:"completedAt,omitempty"` + + // forceSendFields is a list of field names (e.g. "Keys") to + // unconditionally include in API requests. By default, fields with + // empty values are omitted from API requests. However, any non-pointer, + // non-interface field appearing in ForceSendFields will be sent to the + // server regardless of whether the field is empty or not. This may be + // used to include empty fields in Patch requests. + forceSendFields []string + + // nullFields is a list of field names (e.g. "Keys") to include in API + // requests with the JSON null value. By default, fields with empty + // values are omitted from API requests. However, any field with an + // empty value appearing in NullFields will be sent to the server as + // null. It is an error if a field in this list has a non-empty value. + // This may be used to include null fields in Patch requests. + nullFields []string +} +type ReadMigrationInput struct { + ClusterID *string `json:"clusterId,omitempty"` +} + +type ReadMigrationOutput struct { + Migration []*Migration `json:"migration,omitempty"` +} + +func (s *ServiceOp) ListMigrations(ctx context.Context, input *ReadMigrationInput) (*ReadMigrationOutput, error) { + path, err := uritemplates.Expand("/ocean/aws/k8s/cluster/{oceanClusterId}/migration", uritemplates.Values{ + "oceanClusterId": spotinst.StringValue(input.ClusterID), + }) + if err != nil { + return nil, err + } + r := client.NewRequest(http.MethodGet, path) + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + gs, err := migrationsFromHttpResponse(resp) + if err != nil { + return nil, err + } + + return &ReadMigrationOutput{Migration: gs}, nil +} + +func migrationsFromHttpResponse(resp *http.Response) ([]*Migration, error) { + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + return migrationsFromJSON(body) +} + +func migrationsFromJSON(in []byte) ([]*Migration, error) { + var rw client.Response + if err := json.Unmarshal(in, &rw); err != nil { + return nil, err + } + out := make([]*Migration, len(rw.Response.Items)) + if len(out) == 0 { + return out, nil + } + for i, rb := range rw.Response.Items { + b, err := migrationFromJSON(rb) + if err != nil { + return nil, err + } + out[i] = b + } + return out, nil +} + +func migrationFromJSON(in []byte) (*Migration, error) { + b := new(Migration) + if err := json.Unmarshal(in, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/rightsizing.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/rightsizing.go index 4617d3280a..2e23054b60 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/rightsizing.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/rightsizing.go @@ -52,12 +52,6 @@ type Attribute struct { nullFields []string } -// Deprecated: Use ListOceanResourceSuggestionsInput instead. -type ListResourceSuggestionsInput struct { - OceanID *string `json:"oceanId,omitempty"` - Namespace *string `json:"namespace,omitempty"` -} - // Deprecated: Use ListOceanResourceSuggestionsOutput instead. type ListResourceSuggestionsOutput struct { Suggestions []*ResourceSuggestion `json:"suggestions,omitempty"` @@ -74,6 +68,12 @@ type ListOceanResourceSuggestionsOutput struct { Suggestions []*ResourceSuggestion `json:"suggestions,omitempty"` } +// Deprecated: Use ListOceanResourceSuggestionsInput instead. +type ListResourceSuggestionsInput struct { + OceanID *string `json:"oceanId,omitempty"` + Namespace *string `json:"namespace,omitempty"` +} + func resourceSuggestionFromJSON(in []byte) (*ResourceSuggestion, error) { b := new(ResourceSuggestion) if err := json.Unmarshal(in, b); err != nil { diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/service.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/service.go index 3478339cc7..5322f030b9 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/service.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws/service.go @@ -17,7 +17,6 @@ type Service interface { serviceCommon serviceExtendedResourceDefinition } - type serviceKubernetes interface { ListClusters(context.Context, *ListClustersInput) (*ListClustersOutput, error) CreateCluster(context.Context, *CreateClusterInput) (*CreateClusterOutput, error) @@ -46,6 +45,14 @@ type serviceKubernetes interface { Roll(context.Context, *RollClusterInput) (*RollClusterOutput, error) GetClusterAggregatedCosts(context.Context, *ClusterAggregatedCostInput) (*ClusterAggregatedCostOutput, error) + + ReadClusterNodes(context.Context, *ReadClusterNodeInput) (*ReadClusterNodeOutput, error) + + ListMigrations(context.Context, *ReadMigrationInput) (*ReadMigrationOutput, error) + + MigrationStatus(context.Context, *ReadMigrationStatusInput) (*ReadMigrationStatusOutput, error) + AttachLoadBalancer(context.Context, *AttachLoadbalancerInput) (*AttachLoadbalancerOutput, error) + DetachLoadBalancer(context.Context, *DetachLoadbalancerInput) (*DetachLoadbalancerOutput, error) } type serviceECS interface { diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/cluster.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/cluster.go deleted file mode 100644 index e29298e3b4..0000000000 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/cluster.go +++ /dev/null @@ -1,1275 +0,0 @@ -package azure - -import ( - "context" - "encoding/json" - "io/ioutil" - "net/http" - "time" - - "github.com/spotinst/spotinst-sdk-go/spotinst" - "github.com/spotinst/spotinst-sdk-go/spotinst/client" - "github.com/spotinst/spotinst-sdk-go/spotinst/util/jsonutil" - "github.com/spotinst/spotinst-sdk-go/spotinst/util/uritemplates" -) - -type Cluster struct { - ID *string `json:"id,omitempty"` - ControllerClusterID *string `json:"controllerClusterId,omitempty"` - Name *string `json:"name,omitempty"` - AKS *AKS `json:"aks,omitempty"` - AutoScaler *AutoScaler `json:"autoScaler,omitempty"` - Strategy *Strategy `json:"strategy,omitempty"` - Health *Health `json:"health,omitempty"` - VirtualNodeGroupTemplate *VirtualNodeGroupTemplate `json:"virtualNodeGroupTemplate,omitempty"` - - // Read-only fields. - CreatedAt *time.Time `json:"createdAt,omitempty"` - UpdatedAt *time.Time `json:"updatedAt,omitempty"` - - forceSendFields []string - nullFields []string -} - -type AKS struct { - Name *string `json:"name,omitempty"` - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - - forceSendFields []string - nullFields []string -} - -type AutoScaler struct { - IsEnabled *bool `json:"isEnabled,omitempty"` - ResourceLimits *ResourceLimits `json:"resourceLimits,omitempty"` - Down *Down `json:"down,omitempty"` - Headroom *Headroom `json:"headroom,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Strategy struct { - SpotPercentage *int `json:"spotPercentage,omitempty"` - FallbackToOD *bool `json:"fallbackToOd,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Health struct { - GracePeriod *int `json:"gracePeriod,omitempty"` - - forceSendFields []string - nullFields []string -} - -type VirtualNodeGroupTemplate struct { - VMSizes *VMSizes `json:"vmSizes,omitempty"` - LaunchSpecification *LaunchSpecification `json:"launchSpecification,omitempty"` - Zones []string `json:"zones,omitempty"` - - forceSendFields []string - nullFields []string -} - -type ResourceLimits struct { - MaxVCPU *int `json:"maxVCpu,omitempty"` - MaxMemoryGib *int `json:"maxMemoryGib,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Down struct { - MaxScaleDownPercentage *float64 `json:"maxScaleDownPercentage,omitempty"` - FallbackToOD *bool `json:"fallbackToOd,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Headroom struct { - Automatic *Automatic `json:"automatic,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Automatic struct { - IsEnabled *bool `json:"isEnabled,omitempty"` - Percentage *int `json:"percentage,omitempty"` - - forceSendFields []string - nullFields []string -} - -type VMSizes struct { - Whitelist []string `json:"whitelist,omitempty"` - - forceSendFields []string - nullFields []string -} - -type LaunchSpecification struct { - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - CustomData *string `json:"customData,omitempty"` - Image *Image `json:"image,omitempty"` - Network *Network `json:"network,omitempty"` - OSDisk *OSDisk `json:"osDisk,omitempty"` - Login *Login `json:"login,omitempty"` - LoadBalancersConfig *LoadBalancersConfig `json:"loadBalancersConfig,omitempty"` - ManagedServiceIdentities []*ManagedServiceIdentity `json:"managedServiceIdentities,omitempty"` - Extensions []*Extension `json:"extensions,omitempty"` - Tags []*Tag `json:"tags,omitempty"` - MaxPods *int `json:"maxPods,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Extension struct { - APIVersion *string `json:"apiVersion,omitempty"` - MinorVersionAutoUpgrade *bool `json:"minorVersionAutoUpgrade,omitempty"` - Name *string `json:"name,omitempty"` - Publisher *string `json:"publisher,omitempty"` - Type *string `json:"type,omitempty"` - ProtectedSettings interface{} `json:"protectedSettings,omitempty"` - PublicSettings interface{} `json:"publicSettings,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Image struct { - MarketplaceImage *MarketplaceImage `json:"marketplace,omitempty"` - - forceSendFields []string - nullFields []string -} - -type LoadBalancersConfig struct { - LoadBalancers []*LoadBalancer `json:"loadBalancers,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Login struct { - SSHPublicKey *string `json:"sshPublicKey,omitempty"` - UserName *string `json:"userName,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Network struct { - NetworkInterfaces []*NetworkInterface `json:"networkInterfaces,omitempty"` - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - VirtualNetworkName *string `json:"virtualNetworkName,omitempty"` - - forceSendFields []string - nullFields []string -} - -type MarketplaceImage struct { - Publisher *string `json:"publisher,omitempty"` - Offer *string `json:"offer,omitempty"` - SKU *string `json:"sku,omitempty"` - Version *string `json:"version,omitempty"` - - forceSendFields []string - nullFields []string -} - -type LoadBalancer struct { - BackendPoolNames []string `json:"backendPoolNames,omitempty"` - LoadBalancerSKU *string `json:"loadBalancerSku,omitempty"` - Name *string `json:"name,omitempty"` - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - Type *string `json:"type,omitempty"` - - forceSendFields []string - nullFields []string -} - -type NetworkInterface struct { - SubnetName *string `json:"subnetName,omitempty"` - AssignPublicIP *bool `json:"assignPublicIp,omitempty"` - IsPrimary *bool `json:"isPrimary,omitempty"` - EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` - PublicIPSKU *string `json:"publicIpSku,omitempty"` - SecurityGroup *SecurityGroup `json:"securityGroup,omitempty"` - AdditionalIPConfigs []*AdditionalIPConfig `json:"additionalIpConfigurations,omitempty"` - - forceSendFields []string - nullFields []string -} - -type AdditionalIPConfig struct { - Name *string `json:"name,omitempty"` - PrivateIPAddressVersion *string `json:"privateIpAddressVersion,omitempty"` - - forceSendFields []string - nullFields []string -} - -type SecurityGroup struct { - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - Name *string `json:"name,omitempty"` - - forceSendFields []string - nullFields []string -} - -type ManagedServiceIdentity struct { - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - Name *string `json:"name,omitempty"` - - forceSendFields []string - nullFields []string -} - -type ListClustersInput struct{} - -type ListClustersOutput struct { - Clusters []*Cluster `json:"clusters,omitempty"` -} - -type CreateClusterInput struct { - Cluster *Cluster `json:"cluster,omitempty"` -} - -type CreateClusterOutput struct { - Cluster *Cluster `json:"cluster,omitempty"` -} - -type ReadClusterInput struct { - ClusterID *string `json:"clusterId,omitempty"` -} - -type ReadClusterOutput struct { - Cluster *Cluster `json:"cluster,omitempty"` -} - -type UpdateClusterInput struct { - Cluster *Cluster `json:"cluster,omitempty"` -} - -type UpdateClusterOutput struct { - Cluster *Cluster `json:"cluster,omitempty"` -} - -type DeleteClusterInput struct { - ClusterID *string `json:"clusterId,omitempty"` -} - -type DeleteClusterOutput struct{} - -// region Unmarshalls - -func clusterFromJSON(in []byte) (*Cluster, error) { - b := new(Cluster) - if err := json.Unmarshal(in, b); err != nil { - return nil, err - } - return b, nil -} - -func clustersFromJSON(in []byte) ([]*Cluster, error) { - var rw client.Response - if err := json.Unmarshal(in, &rw); err != nil { - return nil, err - } - out := make([]*Cluster, len(rw.Response.Items)) - if len(out) == 0 { - return out, nil - } - for i, rb := range rw.Response.Items { - b, err := clusterFromJSON(rb) - if err != nil { - return nil, err - } - out[i] = b - } - return out, nil -} - -func clustersFromHttpResponse(resp *http.Response) ([]*Cluster, error) { - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - return clustersFromJSON(body) -} - -func clusterImportFromJSON(in []byte) (*ImportClusterOutput, error) { - b := new(ImportClusterOutput) - if err := json.Unmarshal(in, b); err != nil { - return nil, err - } - return b, nil -} - -func clustersImportFromJSON(in []byte) ([]*ImportClusterOutput, error) { - var rw client.Response - if err := json.Unmarshal(in, &rw); err != nil { - return nil, err - } - out := make([]*ImportClusterOutput, len(rw.Response.Items)) - if len(out) == 0 { - return out, nil - } - for i, rb := range rw.Response.Items { - b, err := clusterImportFromJSON(rb) - if err != nil { - return nil, err - } - out[i] = b - } - return out, nil -} - -func clustersImportFromHttpResponse(resp *http.Response) ([]*ImportClusterOutput, error) { - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - return clustersImportFromJSON(body) -} - -// endregion - -// region API requests - -func (s *ServiceOp) ListClusters(ctx context.Context) (*ListClustersOutput, error) { - r := client.NewRequest(http.MethodGet, "/ocean/azure/k8s/cluster") - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - gs, err := clustersFromHttpResponse(resp) - if err != nil { - return nil, err - } - - return &ListClustersOutput{Clusters: gs}, nil -} - -func (s *ServiceOp) CreateCluster(ctx context.Context, input *CreateClusterInput) (*CreateClusterOutput, error) { - r := client.NewRequest(http.MethodPost, "/ocean/azure/k8s/cluster") - r.Obj = input - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - gs, err := clustersFromHttpResponse(resp) - if err != nil { - return nil, err - } - - output := new(CreateClusterOutput) - if len(gs) > 0 { - output.Cluster = gs[0] - } - - return output, nil -} - -func (s *ServiceOp) ReadCluster(ctx context.Context, input *ReadClusterInput) (*ReadClusterOutput, error) { - path, err := uritemplates.Expand("/ocean/azure/k8s/cluster/{clusterId}", uritemplates.Values{ - "clusterId": spotinst.StringValue(input.ClusterID), - }) - if err != nil { - return nil, err - } - - r := client.NewRequest(http.MethodGet, path) - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - gs, err := clustersFromHttpResponse(resp) - if err != nil { - return nil, err - } - - output := new(ReadClusterOutput) - if len(gs) > 0 { - output.Cluster = gs[0] - } - - return output, nil -} - -func (s *ServiceOp) UpdateCluster(ctx context.Context, input *UpdateClusterInput) (*UpdateClusterOutput, error) { - path, err := uritemplates.Expand("/ocean/azure/k8s/cluster/{clusterId}", uritemplates.Values{ - "clusterId": spotinst.StringValue(input.Cluster.ID), - }) - if err != nil { - return nil, err - } - - // We do NOT need the ID anymore, so let's drop it. - input.Cluster.ID = nil - - r := client.NewRequest(http.MethodPut, path) - r.Obj = input - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - gs, err := clustersFromHttpResponse(resp) - if err != nil { - return nil, err - } - - output := new(UpdateClusterOutput) - if len(gs) > 0 { - output.Cluster = gs[0] - } - - return output, nil -} - -func (s *ServiceOp) DeleteCluster(ctx context.Context, input *DeleteClusterInput) (*DeleteClusterOutput, error) { - path, err := uritemplates.Expand("/ocean/azure/k8s/cluster/{clusterId}", uritemplates.Values{ - "clusterId": spotinst.StringValue(input.ClusterID), - }) - if err != nil { - return nil, err - } - - r := client.NewRequest(http.MethodDelete, path) - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - return &DeleteClusterOutput{}, nil -} - -func (s *ServiceOp) ImportCluster(ctx context.Context, input *ImportClusterInput) (*ImportClusterOutput, error) { - path, err := uritemplates.Expand("/ocean/azure/k8s/cluster/aks/import/{acdIdentifier}", uritemplates.Values{ - "acdIdentifier": spotinst.StringValue(input.ACDIdentifier), - }) - if err != nil { - return nil, err - } - - // We do NOT need the ID anymore, so let's drop it. - input.ACDIdentifier = nil - - r := client.NewRequest(http.MethodPost, path) - r.Obj = input - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - gs, err := clustersImportFromHttpResponse(resp) - if err != nil { - return nil, err - } - - output := new(ImportClusterOutput) - if len(gs) > 0 { - output = gs[0] - } - - return output, nil -} - -// endregion - -// region Cluster - -func (o Cluster) MarshalJSON() ([]byte, error) { - type noMethod Cluster - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Cluster) SetId(v *string) *Cluster { - if o.ID = v; o.ID == nil { - o.nullFields = append(o.nullFields, "ID") - } - return o -} - -func (o *Cluster) SetControllerClusterId(v *string) *Cluster { - if o.ControllerClusterID = v; o.ControllerClusterID == nil { - o.nullFields = append(o.nullFields, "ControllerClusterID") - } - return o -} - -func (o *Cluster) SetName(v *string) *Cluster { - if o.Name = v; o.Name == nil { - o.nullFields = append(o.nullFields, "Name") - } - return o -} - -func (o *Cluster) SetAKS(v *AKS) *Cluster { - if o.AKS = v; o.AKS == nil { - o.nullFields = append(o.nullFields, "AKS") - } - return o -} - -func (o *Cluster) SetStrategy(v *Strategy) *Cluster { - if o.Strategy = v; o.Strategy == nil { - o.nullFields = append(o.nullFields, "Strategy") - } - return o -} - -func (o *Cluster) SetHealth(v *Health) *Cluster { - if o.Health = v; o.Health == nil { - o.nullFields = append(o.nullFields, "Health") - } - return o -} - -func (o *Cluster) SetAutoScaler(v *AutoScaler) *Cluster { - if o.AutoScaler = v; o.AutoScaler == nil { - o.nullFields = append(o.nullFields, "AutoScaler") - } - return o -} - -func (o *Cluster) SetVirtualNodeGroupTemplate(v *VirtualNodeGroupTemplate) *Cluster { - if o.VirtualNodeGroupTemplate = v; o.VirtualNodeGroupTemplate == nil { - o.nullFields = append(o.nullFields, "VirtualNodeGroupTemplate") - } - return o -} - -// endregion - -// region AKS - -func (o AKS) MarshalJSON() ([]byte, error) { - type noMethod AKS - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *AKS) SetName(v *string) *AKS { - if o.Name = v; o.Name == nil { - o.nullFields = append(o.nullFields, "Name") - } - return o -} - -func (o *AKS) SetResourceGroupName(v *string) *AKS { - if o.ResourceGroupName = v; o.ResourceGroupName == nil { - o.nullFields = append(o.nullFields, "ResourceGroupName") - } - return o -} - -// endregion - -// region Import - -type ImportCluster struct { - ControllerClusterID *string `json:"controllerClusterId,omitempty"` - Name *string `json:"name,omitempty"` - AKS *AKS `json:"aks,omitempty"` - - forceSendFields []string - nullFields []string -} - -type ImportClusterInput struct { - ACDIdentifier *string `json:"acdIdentifier,omitempty"` - Cluster *ImportCluster `json:"cluster,omitempty"` -} - -type ImportClusterOutput struct { - Cluster *Cluster `json:"cluster,omitempty"` -} - -// endregion - -// region AutoScaler - -func (o AutoScaler) MarshalJSON() ([]byte, error) { - type noMethod AutoScaler - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *AutoScaler) SetIsEnabled(v *bool) *AutoScaler { - if o.IsEnabled = v; o.IsEnabled == nil { - o.nullFields = append(o.nullFields, "IsEnabled") - } - return o -} - -func (o *AutoScaler) SetResourceLimits(v *ResourceLimits) *AutoScaler { - if o.ResourceLimits = v; o.ResourceLimits == nil { - o.nullFields = append(o.nullFields, "ResourceLimits") - } - return o -} - -func (o *AutoScaler) SetDown(v *Down) *AutoScaler { - if o.Down = v; o.Down == nil { - o.nullFields = append(o.nullFields, "Down") - } - return o -} - -func (o *AutoScaler) SetHeadroom(v *Headroom) *AutoScaler { - if o.Headroom = v; o.Headroom == nil { - o.nullFields = append(o.nullFields, "Headroom") - } - return o -} - -// endregion - -// region Strategy - -func (o Strategy) MarshalJSON() ([]byte, error) { - type noMethod Strategy - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Strategy) SetFallbackToOD(v *bool) *Strategy { - if o.FallbackToOD = v; o.FallbackToOD == nil { - o.nullFields = append(o.nullFields, "FallbackToOD") - } - return o -} - -func (o *Strategy) SetSpotPercentage(v *int) *Strategy { - if o.SpotPercentage = v; o.SpotPercentage == nil { - o.nullFields = append(o.nullFields, "SpotPercentage") - } - return o -} - -// endregion - -// region Health - -func (o Health) MarshalJSON() ([]byte, error) { - type noMethod Health - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Health) SetGracePeriod(v *int) *Health { - if o.GracePeriod = v; o.GracePeriod == nil { - o.nullFields = append(o.nullFields, "GracePeriod") - } - return o -} - -// endregion - -// region VirtualNodeGroupTemplate - -func (o VirtualNodeGroupTemplate) MarshalJSON() ([]byte, error) { - type noMethod VirtualNodeGroupTemplate - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *VirtualNodeGroupTemplate) SetVMSizes(v *VMSizes) *VirtualNodeGroupTemplate { - if o.VMSizes = v; o.VMSizes == nil { - o.nullFields = append(o.nullFields, "VMSizes") - } - return o -} - -func (o *VirtualNodeGroupTemplate) SetLaunchSpecification(v *LaunchSpecification) *VirtualNodeGroupTemplate { - if o.LaunchSpecification = v; o.LaunchSpecification == nil { - o.nullFields = append(o.nullFields, "LaunchSpecification") - } - return o -} - -func (o *VirtualNodeGroupTemplate) SetZones(v []string) *VirtualNodeGroupTemplate { - if o.Zones = v; o.Zones == nil { - o.nullFields = append(o.nullFields, "Zones") - } - return o -} - -// endregion - -// region ResourceLimits - -func (o ResourceLimits) MarshalJSON() ([]byte, error) { - type noMethod ResourceLimits - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *ResourceLimits) SetMaxVCPU(v *int) *ResourceLimits { - if o.MaxVCPU = v; o.MaxVCPU == nil { - o.nullFields = append(o.nullFields, "MaxVCPU") - } - return o -} - -func (o *ResourceLimits) SetMaxMemoryGib(v *int) *ResourceLimits { - if o.MaxMemoryGib = v; o.MaxMemoryGib == nil { - o.nullFields = append(o.nullFields, "MaxMemoryGib") - } - return o -} - -// endregion - -// region Down - -func (o Down) MarshalJSON() ([]byte, error) { - type noMethod Down - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Down) SetMaxScaleDownPercentage(v *float64) *Down { - if o.MaxScaleDownPercentage = v; o.MaxScaleDownPercentage == nil { - o.nullFields = append(o.nullFields, "MaxScaleDownPercentage") - } - return o -} - -func (o *Down) SetFallbackToOD(v *bool) *Down { - if o.FallbackToOD = v; o.FallbackToOD == nil { - o.nullFields = append(o.nullFields, "FallbackToOD") - } - return o -} - -// endregion - -// region Headroom - -func (o Headroom) MarshalJSON() ([]byte, error) { - type noMethod Headroom - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Headroom) SetAutomatic(v *Automatic) *Headroom { - if o.Automatic = v; o.Automatic == nil { - o.nullFields = append(o.nullFields, "Automatic") - } - return o -} - -// endregion - -// region Automatic - -func (o Automatic) MarshalJSON() ([]byte, error) { - type noMethod Automatic - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Automatic) SetIsEnabled(v *bool) *Automatic { - if o.IsEnabled = v; o.IsEnabled == nil { - o.nullFields = append(o.nullFields, "IsEnabled") - } - return o -} - -func (o *Automatic) SetPercentage(v *int) *Automatic { - if o.Percentage = v; o.Percentage == nil { - o.nullFields = append(o.nullFields, "Percentage") - } - return o -} - -// endregion - -// region VMSizes - -func (o VMSizes) MarshalJSON() ([]byte, error) { - type noMethod VMSizes - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *VMSizes) SetWhitelist(v []string) *VMSizes { - if o.Whitelist = v; o.Whitelist == nil { - o.nullFields = append(o.nullFields, "Whitelist") - } - return o -} - -// endregion - -// region LaunchSpecification - -func (o LaunchSpecification) MarshalJSON() ([]byte, error) { - type noMethod LaunchSpecification - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *LaunchSpecification) SetResourceGroupName(v *string) *LaunchSpecification { - if o.ResourceGroupName = v; o.ResourceGroupName == nil { - o.nullFields = append(o.nullFields, "ResourceGroupName") - } - return o -} - -func (o *LaunchSpecification) SetCustomData(v *string) *LaunchSpecification { - if o.CustomData = v; o.CustomData == nil { - o.nullFields = append(o.nullFields, "CustomData") - } - return o -} - -func (o *LaunchSpecification) SetImage(v *Image) *LaunchSpecification { - if o.Image = v; o.Image == nil { - o.nullFields = append(o.nullFields, "Image") - } - return o -} - -func (o *LaunchSpecification) SetNetwork(v *Network) *LaunchSpecification { - if o.Network = v; o.Network == nil { - o.nullFields = append(o.nullFields, "Network") - } - return o -} - -func (o *LaunchSpecification) SetLogin(v *Login) *LaunchSpecification { - if o.Login = v; o.Login == nil { - o.nullFields = append(o.nullFields, "Login") - } - return o -} - -func (o *LaunchSpecification) SetManagedServiceIdentities(v []*ManagedServiceIdentity) *LaunchSpecification { - if o.ManagedServiceIdentities = v; o.ManagedServiceIdentities == nil { - o.nullFields = append(o.nullFields, "ManagedServiceIdentities") - } - return o -} - -func (o *LaunchSpecification) SetExtensions(v []*Extension) *LaunchSpecification { - if o.Extensions = v; o.Extensions == nil { - o.nullFields = append(o.nullFields, "Extensions") - } - return o -} - -func (o *LaunchSpecification) SetLoadBalancersConfig(v *LoadBalancersConfig) *LaunchSpecification { - if o.LoadBalancersConfig = v; o.LoadBalancersConfig == nil { - o.nullFields = append(o.nullFields, "LoadBalancersConfig") - } - return o -} - -func (o *LaunchSpecification) SetOSDisk(v *OSDisk) *LaunchSpecification { - if o.OSDisk = v; o.OSDisk == nil { - o.nullFields = append(o.nullFields, "OSDisk") - } - return o -} - -func (o *LaunchSpecification) SetTags(v []*Tag) *LaunchSpecification { - if o.Tags = v; o.Tags == nil { - o.nullFields = append(o.nullFields, "Tags") - } - return o -} - -func (o *LaunchSpecification) SetMaxPods(v *int) *LaunchSpecification { - if o.MaxPods = v; o.MaxPods == nil { - o.nullFields = append(o.nullFields, "MaxPods") - } - return o -} - -// endregion - -// region Image - -func (o Image) MarshalJSON() ([]byte, error) { - type noMethod Image - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Image) SetMarketplaceImage(v *MarketplaceImage) *Image { - if o.MarketplaceImage = v; o.MarketplaceImage == nil { - o.nullFields = append(o.nullFields, "MarketplaceImage") - } - return o -} - -// endregion - -// region MarketplaceImage - -func (o MarketplaceImage) MarshalJSON() ([]byte, error) { - type noMethod MarketplaceImage - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *MarketplaceImage) SetPublisher(v *string) *MarketplaceImage { - if o.Publisher = v; o.Publisher == nil { - o.nullFields = append(o.nullFields, "Publisher") - } - return o -} - -func (o *MarketplaceImage) SetOffer(v *string) *MarketplaceImage { - if o.Offer = v; o.Offer == nil { - o.nullFields = append(o.nullFields, "Offer") - } - return o -} - -func (o *MarketplaceImage) SetSKU(v *string) *MarketplaceImage { - if o.SKU = v; o.SKU == nil { - o.nullFields = append(o.nullFields, "SKU") - } - return o -} - -func (o *MarketplaceImage) SetVersion(v *string) *MarketplaceImage { - if o.Version = v; o.Version == nil { - o.nullFields = append(o.nullFields, "Version") - } - return o -} - -// endregion - -// region Network - -func (o Network) MarshalJSON() ([]byte, error) { - type noMethod Network - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Network) SetVirtualNetworkName(v *string) *Network { - if o.VirtualNetworkName = v; o.VirtualNetworkName == nil { - o.nullFields = append(o.nullFields, "VirtualNetworkName") - } - return o -} - -func (o *Network) SetResourceGroupName(v *string) *Network { - if o.ResourceGroupName = v; o.ResourceGroupName == nil { - o.nullFields = append(o.nullFields, "ResourceGroupName") - } - return o -} - -func (o *Network) SetNetworkInterfaces(v []*NetworkInterface) *Network { - if o.NetworkInterfaces = v; o.NetworkInterfaces == nil { - o.nullFields = append(o.nullFields, "NetworkInterfaces") - } - return o -} - -// endregion - -// region NetworkInterface - -func (o NetworkInterface) MarshalJSON() ([]byte, error) { - type noMethod NetworkInterface - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *NetworkInterface) SetSubnetName(v *string) *NetworkInterface { - if o.SubnetName = v; o.SubnetName == nil { - o.nullFields = append(o.nullFields, "SubnetName") - } - return o -} - -func (o *NetworkInterface) SetAdditionalIPConfigs(v []*AdditionalIPConfig) *NetworkInterface { - if o.AdditionalIPConfigs = v; o.AdditionalIPConfigs == nil { - o.nullFields = append(o.nullFields, "AdditionalIPConfigs") - } - return o -} - -func (o *NetworkInterface) SetAssignPublicIP(v *bool) *NetworkInterface { - if o.AssignPublicIP = v; o.AssignPublicIP == nil { - o.nullFields = append(o.nullFields, "AssignPublicIP") - } - return o -} - -func (o *NetworkInterface) SetIsPrimary(v *bool) *NetworkInterface { - if o.IsPrimary = v; o.IsPrimary == nil { - o.nullFields = append(o.nullFields, "IsPrimary") - } - return o -} - -func (o *NetworkInterface) SetEnableIPForwarding(v *bool) *NetworkInterface { - if o.EnableIPForwarding = v; o.EnableIPForwarding == nil { - o.nullFields = append(o.nullFields, "EnableIPForwarding") - } - return o -} - -func (o *NetworkInterface) SetPublicIPSKU(v *string) *NetworkInterface { - if o.PublicIPSKU = v; o.PublicIPSKU == nil { - o.nullFields = append(o.nullFields, "PublicIPSKU") - } - return o -} - -func (o *NetworkInterface) SetSecurityGroup(v *SecurityGroup) *NetworkInterface { - if o.SecurityGroup = v; o.SecurityGroup == nil { - o.nullFields = append(o.nullFields, "SecurityGroup") - } - return o -} - -// endregion - -// region AdditionalIPConfig - -func (o AdditionalIPConfig) MarshalJSON() ([]byte, error) { - type noMethod AdditionalIPConfig - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -// SetName sets the name -func (o *AdditionalIPConfig) SetName(v *string) *AdditionalIPConfig { - if o.Name = v; o.Name == nil { - o.nullFields = append(o.nullFields, "Name") - } - return o -} - -// SetPrivateIPAddressVersion sets the ip address version -func (o *AdditionalIPConfig) SetPrivateIPAddressVersion(v *string) *AdditionalIPConfig { - if o.PrivateIPAddressVersion = v; o.PrivateIPAddressVersion == nil { - o.nullFields = append(o.nullFields, "PrivateIPAddressVersion") - } - return o -} - -// endregion - -// region Login - -func (o Login) MarshalJSON() ([]byte, error) { - type noMethod Login - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Login) SetUserName(v *string) *Login { - if o.UserName = v; o.UserName == nil { - o.nullFields = append(o.nullFields, "UserName") - } - return o -} - -func (o *Login) SetSSHPublicKey(v *string) *Login { - if o.SSHPublicKey = v; o.SSHPublicKey == nil { - o.nullFields = append(o.nullFields, "SSHPublicKey") - } - return o -} - -// endregion - -// region Extension - -func (o Extension) MarshalJSON() ([]byte, error) { - type noMethod Extension - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Extension) SetAPIVersion(v *string) *Extension { - if o.APIVersion = v; o.APIVersion == nil { - o.nullFields = append(o.nullFields, "APIVersion") - } - return o -} - -func (o *Extension) SetName(v *string) *Extension { - if o.Name = v; o.Name == nil { - o.nullFields = append(o.nullFields, "Name") - } - return o -} - -func (o *Extension) SetPublisher(v *string) *Extension { - if o.Publisher = v; o.Publisher == nil { - o.nullFields = append(o.nullFields, "Publisher") - } - return o -} - -func (o *Extension) SetType(v *string) *Extension { - if o.Type = v; o.Type == nil { - o.nullFields = append(o.nullFields, "Type") - } - return o -} - -func (o *Extension) SetMinorVersionAutoUpgrade(v *bool) *Extension { - if o.MinorVersionAutoUpgrade = v; o.MinorVersionAutoUpgrade == nil { - o.nullFields = append(o.nullFields, "MinorVersionAutoUpgrade") - } - return o -} - -func (o *Extension) SetProtectedSettings(v interface{}) *Extension { - if o.ProtectedSettings = v; o.ProtectedSettings == nil { - o.nullFields = append(o.nullFields, "ProtectedSettings") - } - return o -} - -func (o *Extension) SetPublicSettings(v interface{}) *Extension { - if o.PublicSettings = v; o.PublicSettings == nil { - o.nullFields = append(o.nullFields, "PublicSettings") - } - return o -} - -// endregion - -// region LoadBalancersConfig - -func (o LoadBalancersConfig) MarshalJSON() ([]byte, error) { - type noMethod LoadBalancersConfig - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *LoadBalancersConfig) SetLoadBalancers(v []*LoadBalancer) *LoadBalancersConfig { - if o.LoadBalancers = v; o.LoadBalancers == nil { - o.nullFields = append(o.nullFields, "LoadBalancers") - } - return o -} - -// endregion - -// region LoadBalancer - -func (o LoadBalancer) MarshalJSON() ([]byte, error) { - type noMethod LoadBalancer - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *LoadBalancer) SetLoadBalancerSKU(v *string) *LoadBalancer { - if o.LoadBalancerSKU = v; o.LoadBalancerSKU == nil { - o.nullFields = append(o.nullFields, "LoadBalancerSKU") - } - return o -} - -func (o *LoadBalancer) SetName(v *string) *LoadBalancer { - if o.Name = v; o.Name == nil { - o.nullFields = append(o.nullFields, "Name") - } - return o -} - -func (o *LoadBalancer) SetResourceGroupName(v *string) *LoadBalancer { - if o.ResourceGroupName = v; o.ResourceGroupName == nil { - o.nullFields = append(o.nullFields, "ResourceGroupName") - } - return o -} - -func (o *LoadBalancer) SetType(v *string) *LoadBalancer { - if o.Type = v; o.Type == nil { - o.nullFields = append(o.nullFields, "Type") - } - return o -} - -func (o *LoadBalancer) SeBackendPoolNames(v []string) *LoadBalancer { - if o.BackendPoolNames = v; o.BackendPoolNames == nil { - o.nullFields = append(o.nullFields, "BackendPoolNames") - } - return o -} - -// endregion - -// region SecurityGroup - -func (o SecurityGroup) MarshalJSON() ([]byte, error) { - type noMethod SecurityGroup - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *SecurityGroup) SetResourceGroupName(v *string) *SecurityGroup { - if o.ResourceGroupName = v; o.ResourceGroupName == nil { - o.nullFields = append(o.nullFields, "ResourceGroupName") - } - return o -} - -func (o *SecurityGroup) SetName(v *string) *SecurityGroup { - if o.Name = v; o.Name == nil { - o.nullFields = append(o.nullFields, "Name") - } - return o -} - -// endregion - -// region ManagedServiceIdentity - -func (o ManagedServiceIdentity) MarshalJSON() ([]byte, error) { - type noMethod ManagedServiceIdentity - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *ManagedServiceIdentity) SetResourceGroupName(v *string) *ManagedServiceIdentity { - if o.ResourceGroupName = v; o.ResourceGroupName == nil { - o.nullFields = append(o.nullFields, "ResourceGroupName") - } - return o -} - -func (o *ManagedServiceIdentity) SetName(v *string) *ManagedServiceIdentity { - if o.Name = v; o.Name == nil { - o.nullFields = append(o.nullFields, "Name") - } - return o -} - -// endregion diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/common.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/common.go deleted file mode 100644 index 8e9f33b3ca..0000000000 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/common.go +++ /dev/null @@ -1,147 +0,0 @@ -package azure - -import "github.com/spotinst/spotinst-sdk-go/spotinst/util/jsonutil" - -// region Tag - -type Tag struct { - Key *string `json:"tagKey,omitempty"` - Value *string `json:"tagValue,omitempty"` - - forceSendFields []string - nullFields []string -} - -func (o Tag) MarshalJSON() ([]byte, error) { - type noMethod Tag - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Tag) SetKey(v *string) *Tag { - if o.Key = v; o.Key == nil { - o.nullFields = append(o.nullFields, "Key") - } - return o -} - -func (o *Tag) SetValue(v *string) *Tag { - if o.Value = v; o.Value == nil { - o.nullFields = append(o.nullFields, "Value") - } - return o -} - -// endregion - -// region OSDisk - -type OSDisk struct { - SizeGB *int `json:"sizeGB,omitempty"` - Type *string `json:"type,omitempty"` - UtilizeEphemeralStorage *bool `json:"utilizeEphemeralStorage,omitempty"` - - forceSendFields []string - nullFields []string -} - -func (o OSDisk) MarshalJSON() ([]byte, error) { - type noMethod OSDisk - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *OSDisk) SetSizeGB(v *int) *OSDisk { - if o.SizeGB = v; o.SizeGB == nil { - o.nullFields = append(o.nullFields, "SizeGB") - } - return o -} - -func (o *OSDisk) SetType(v *string) *OSDisk { - if o.Type = v; o.Type == nil { - o.nullFields = append(o.nullFields, "Type") - } - return o -} - -func (o *OSDisk) SetUtilizeEphemeralStorage(v *bool) *OSDisk { - if o.UtilizeEphemeralStorage = v; o.UtilizeEphemeralStorage == nil { - o.nullFields = append(o.nullFields, "UtilizeEphemeralStorage") - } - return o -} - -// endregion - -// region Label - -type Label struct { - Key *string `json:"key,omitempty"` - Value *string `json:"value,omitempty"` - - forceSendFields []string - nullFields []string -} - -func (o Label) MarshalJSON() ([]byte, error) { - type noMethod Label - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Label) SetKey(v *string) *Label { - if o.Key = v; o.Key == nil { - o.nullFields = append(o.nullFields, "Key") - } - return o -} - -func (o *Label) SetValue(v *string) *Label { - if o.Value = v; o.Value == nil { - o.nullFields = append(o.nullFields, "Value") - } - return o -} - -// endregion - -// region Taint - -type Taint struct { - Key *string `json:"key,omitempty"` - Value *string `json:"value,omitempty"` - Effect *string `json:"effect,omitempty"` - - forceSendFields []string - nullFields []string -} - -func (o Taint) MarshalJSON() ([]byte, error) { - type noMethod Taint - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *Taint) SetKey(v *string) *Taint { - if o.Key = v; o.Key == nil { - o.nullFields = append(o.nullFields, "Key") - } - return o -} - -func (o *Taint) SetValue(v *string) *Taint { - if o.Value = v; o.Value == nil { - o.nullFields = append(o.nullFields, "Value") - } - return o -} - -func (o *Taint) SetEffect(v *string) *Taint { - if o.Effect = v; o.Effect == nil { - o.nullFields = append(o.nullFields, "Effect") - } - return o -} - -// endregion diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/nodegroup.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/nodegroup.go deleted file mode 100644 index e9de1945a5..0000000000 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/nodegroup.go +++ /dev/null @@ -1,446 +0,0 @@ -package azure - -import ( - "context" - "encoding/json" - "io/ioutil" - "net/http" - "time" - - "github.com/spotinst/spotinst-sdk-go/spotinst" - "github.com/spotinst/spotinst-sdk-go/spotinst/client" - "github.com/spotinst/spotinst-sdk-go/spotinst/util/jsonutil" - "github.com/spotinst/spotinst-sdk-go/spotinst/util/uritemplates" -) - -type VirtualNodeGroup struct { - ID *string `json:"id,omitempty"` - OceanID *string `json:"oceanId,omitempty"` - Name *string `json:"name,omitempty"` - Labels []*Label `json:"labels,omitempty"` - Taints []*Taint `json:"taints,omitempty"` - AutoScale *VirtualNodeGroupAutoScale `json:"autoScale,omitempty"` - ResourceLimits *VirtualNodeGroupResourceLimits `json:"resourceLimits,omitempty"` - LaunchSpecification *VirtualNodeGroupLaunchSpecification `json:"launchSpecification,omitempty"` - Zones []string `json:"zones,omitempty"` - - // Read-only fields. - CreatedAt *time.Time `json:"createdAt,omitempty"` - UpdatedAt *time.Time `json:"updatedAt,omitempty"` - - forceSendFields []string - nullFields []string -} - -type VirtualNodeGroupResourceLimits struct { - MaxInstanceCount *int `json:"maxInstanceCount,omitempty"` - - forceSendFields []string - nullFields []string -} - -type VirtualNodeGroupAutoScale struct { - Headrooms []*VirtualNodeGroupHeadroom `json:"headrooms,omitempty"` - AutoHeadroomPercentage *int `json:"autoHeadroomPercentage,omitempty"` - - forceSendFields []string - nullFields []string -} - -type VirtualNodeGroupHeadroom struct { - CPUPerUnit *int `json:"cpuPerUnit,omitempty"` - GPUPerUnit *int `json:"gpuPerUnit,omitempty"` - MemoryPerUnit *int `json:"memoryPerUnit,omitempty"` - NumOfUnits *int `json:"numOfUnits,omitempty"` - - forceSendFields []string - nullFields []string -} - -type VirtualNodeGroupLaunchSpecification struct { - OSDisk *OSDisk `json:"osDisk,omitempty"` - Tags []*Tag `json:"tags,omitempty"` - MaxPods *int `json:"maxPods,omitempty"` - - forceSendFields []string - nullFields []string -} - -type ListVirtualNodeGroupsInput struct { - OceanID *string `json:"oceanId,omitempty"` -} - -type ListVirtualNodeGroupsOutput struct { - VirtualNodeGroups []*VirtualNodeGroup `json:"virtualNodeGroups,omitempty"` -} - -type CreateVirtualNodeGroupInput struct { - VirtualNodeGroup *VirtualNodeGroup `json:"virtualNodeGroup,omitempty"` -} - -type CreateVirtualNodeGroupOutput struct { - VirtualNodeGroup *VirtualNodeGroup `json:"virtualNodeGroup,omitempty"` -} - -type ReadVirtualNodeGroupInput struct { - VirtualNodeGroupID *string `json:"virtualNodeGroupId,omitempty"` -} - -type ReadVirtualNodeGroupOutput struct { - VirtualNodeGroup *VirtualNodeGroup `json:"virtualNodeGroup,omitempty"` -} - -type UpdateVirtualNodeGroupInput struct { - VirtualNodeGroup *VirtualNodeGroup `json:"virtualNodeGroup,omitempty"` -} - -type UpdateVirtualNodeGroupOutput struct { - VirtualNodeGroup *VirtualNodeGroup `json:"virtualNodeGroup,omitempty"` -} - -type DeleteVirtualNodeGroupInput struct { - VirtualNodeGroupID *string `json:"virtualNodeGroupId,omitempty"` -} - -type DeleteVirtualNodeGroupOutput struct{} - -func virtualNodeGroupFromJSON(in []byte) (*VirtualNodeGroup, error) { - b := new(VirtualNodeGroup) - if err := json.Unmarshal(in, b); err != nil { - return nil, err - } - return b, nil -} - -func virtualNodeGroupsFromJSON(in []byte) ([]*VirtualNodeGroup, error) { - var rw client.Response - if err := json.Unmarshal(in, &rw); err != nil { - return nil, err - } - out := make([]*VirtualNodeGroup, len(rw.Response.Items)) - if len(out) == 0 { - return out, nil - } - for i, rb := range rw.Response.Items { - b, err := virtualNodeGroupFromJSON(rb) - if err != nil { - return nil, err - } - out[i] = b - } - return out, nil -} - -func virtualNodeGroupsFromHttpResponse(resp *http.Response) ([]*VirtualNodeGroup, error) { - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - return virtualNodeGroupsFromJSON(body) -} - -func (s *ServiceOp) ListVirtualNodeGroups(ctx context.Context, input *ListVirtualNodeGroupsInput) (*ListVirtualNodeGroupsOutput, error) { - r := client.NewRequest(http.MethodGet, "/ocean/azure/k8s/virtualNodeGroup") - - if input.OceanID != nil { - r.Params.Set("oceanId", spotinst.StringValue(input.OceanID)) - } - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - vngs, err := virtualNodeGroupsFromHttpResponse(resp) - if err != nil { - return nil, err - } - - return &ListVirtualNodeGroupsOutput{VirtualNodeGroups: vngs}, nil -} - -func (s *ServiceOp) CreateVirtualNodeGroup(ctx context.Context, input *CreateVirtualNodeGroupInput) (*CreateVirtualNodeGroupOutput, error) { - r := client.NewRequest(http.MethodPost, "/ocean/azure/k8s/virtualNodeGroup") - r.Obj = input - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - vngs, err := virtualNodeGroupsFromHttpResponse(resp) - if err != nil { - return nil, err - } - - output := new(CreateVirtualNodeGroupOutput) - if len(vngs) > 0 { - output.VirtualNodeGroup = vngs[0] - } - - return output, nil -} - -func (s *ServiceOp) ReadVirtualNodeGroup(ctx context.Context, input *ReadVirtualNodeGroupInput) (*ReadVirtualNodeGroupOutput, error) { - path, err := uritemplates.Expand("/ocean/azure/k8s/virtualNodeGroup/{virtualNodeGroupId}", uritemplates.Values{ - "virtualNodeGroupId": spotinst.StringValue(input.VirtualNodeGroupID), - }) - if err != nil { - return nil, err - } - - r := client.NewRequest(http.MethodGet, path) - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - vngs, err := virtualNodeGroupsFromHttpResponse(resp) - if err != nil { - return nil, err - } - - output := new(ReadVirtualNodeGroupOutput) - if len(vngs) > 0 { - output.VirtualNodeGroup = vngs[0] - } - - return output, nil -} - -func (s *ServiceOp) UpdateVirtualNodeGroup(ctx context.Context, input *UpdateVirtualNodeGroupInput) (*UpdateVirtualNodeGroupOutput, error) { - path, err := uritemplates.Expand("/ocean/azure/k8s/virtualNodeGroup/{virtualNodeGroupId}", uritemplates.Values{ - "virtualNodeGroupId": spotinst.StringValue(input.VirtualNodeGroup.ID), - }) - if err != nil { - return nil, err - } - - // We do not need the ID anymore so let's drop it. - input.VirtualNodeGroup.ID = nil - - r := client.NewRequest(http.MethodPut, path) - r.Obj = input - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - vngs, err := virtualNodeGroupsFromHttpResponse(resp) - if err != nil { - return nil, err - } - - output := new(UpdateVirtualNodeGroupOutput) - if len(vngs) > 0 { - output.VirtualNodeGroup = vngs[0] - } - - return output, nil -} - -func (s *ServiceOp) DeleteVirtualNodeGroup(ctx context.Context, input *DeleteVirtualNodeGroupInput) (*DeleteVirtualNodeGroupOutput, error) { - path, err := uritemplates.Expand("/ocean/azure/k8s/virtualNodeGroup/{virtualNodeGroupId}", uritemplates.Values{ - "virtualNodeGroupId": spotinst.StringValue(input.VirtualNodeGroupID), - }) - if err != nil { - return nil, err - } - - r := client.NewRequest(http.MethodDelete, path) - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - return &DeleteVirtualNodeGroupOutput{}, nil -} - -// region VirtualNodeGroup - -func (o VirtualNodeGroup) MarshalJSON() ([]byte, error) { - type noMethod VirtualNodeGroup - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *VirtualNodeGroup) SetId(v *string) *VirtualNodeGroup { - if o.ID = v; o.ID == nil { - o.nullFields = append(o.nullFields, "ID") - } - return o -} - -func (o *VirtualNodeGroup) SetOceanId(v *string) *VirtualNodeGroup { - if o.OceanID = v; o.OceanID == nil { - o.nullFields = append(o.nullFields, "OceanID") - } - return o -} - -func (o *VirtualNodeGroup) SetName(v *string) *VirtualNodeGroup { - if o.Name = v; o.Name == nil { - o.nullFields = append(o.nullFields, "Name") - } - return o -} - -func (o *VirtualNodeGroup) SetLabels(v []*Label) *VirtualNodeGroup { - if o.Labels = v; o.Labels == nil { - o.nullFields = append(o.nullFields, "Labels") - } - return o -} - -func (o *VirtualNodeGroup) SetTaints(v []*Taint) *VirtualNodeGroup { - if o.Taints = v; o.Taints == nil { - o.nullFields = append(o.nullFields, "Taints") - } - return o -} - -func (o *VirtualNodeGroup) SetResourceLimits(v *VirtualNodeGroupResourceLimits) *VirtualNodeGroup { - if o.ResourceLimits = v; o.ResourceLimits == nil { - o.nullFields = append(o.nullFields, "ResourceLimits") - } - return o -} - -func (o *VirtualNodeGroup) SetLaunchSpecification(v *VirtualNodeGroupLaunchSpecification) *VirtualNodeGroup { - if o.LaunchSpecification = v; o.LaunchSpecification == nil { - o.nullFields = append(o.nullFields, "LaunchSpecification") - } - return o -} - -func (o *VirtualNodeGroup) SetAutoScale(v *VirtualNodeGroupAutoScale) *VirtualNodeGroup { - if o.AutoScale = v; o.AutoScale == nil { - o.nullFields = append(o.nullFields, "AutoScale") - } - return o -} - -func (o *VirtualNodeGroup) SetZones(v []string) *VirtualNodeGroup { - if o.Zones = v; o.Zones == nil { - o.nullFields = append(o.nullFields, "Zones") - } - return o -} - -// endregion - -// region VirtualNodeGroupAutoScale - -func (o VirtualNodeGroupAutoScale) MarshalJSON() ([]byte, error) { - type noMethod VirtualNodeGroupAutoScale - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *VirtualNodeGroupAutoScale) SetHeadrooms(v []*VirtualNodeGroupHeadroom) *VirtualNodeGroupAutoScale { - if o.Headrooms = v; o.Headrooms == nil { - o.nullFields = append(o.nullFields, "Headrooms") - } - return o -} - -func (o *VirtualNodeGroupAutoScale) SetAutoHeadroomPercentage(v *int) *VirtualNodeGroupAutoScale { - if o.AutoHeadroomPercentage = v; o.AutoHeadroomPercentage == nil { - o.nullFields = append(o.nullFields, "AutoHeadroomPercentage") - } - return o -} - -//endregion - -// region VirtualNodeGroupHeadroom - -func (o VirtualNodeGroupHeadroom) MarshalJSON() ([]byte, error) { - type noMethod VirtualNodeGroupHeadroom - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *VirtualNodeGroupHeadroom) SetCPUPerUnit(v *int) *VirtualNodeGroupHeadroom { - if o.CPUPerUnit = v; o.CPUPerUnit == nil { - o.nullFields = append(o.nullFields, "CPUPerUnit") - } - return o -} - -func (o *VirtualNodeGroupHeadroom) SetGPUPerUnit(v *int) *VirtualNodeGroupHeadroom { - if o.GPUPerUnit = v; o.GPUPerUnit == nil { - o.nullFields = append(o.nullFields, "GPUPerUnit") - } - return o -} - -func (o *VirtualNodeGroupHeadroom) SetMemoryPerUnit(v *int) *VirtualNodeGroupHeadroom { - if o.MemoryPerUnit = v; o.MemoryPerUnit == nil { - o.nullFields = append(o.nullFields, "MemoryPerUnit") - } - return o -} - -func (o *VirtualNodeGroupHeadroom) SetNumOfUnits(v *int) *VirtualNodeGroupHeadroom { - if o.NumOfUnits = v; o.NumOfUnits == nil { - o.nullFields = append(o.nullFields, "NumOfUnits") - } - return o -} - -// endregion - -// region VirtualNodeGroupResourceLimits - -func (o VirtualNodeGroupResourceLimits) MarshalJSON() ([]byte, error) { - type noMethod VirtualNodeGroupResourceLimits - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *VirtualNodeGroupResourceLimits) SetMaxInstanceCount(v *int) *VirtualNodeGroupResourceLimits { - if o.MaxInstanceCount = v; o.MaxInstanceCount == nil { - o.nullFields = append(o.nullFields, "MaxInstanceCount") - } - return o -} - -// endregion - -// region VirtualNodeGroupLaunchSpecification - -func (o VirtualNodeGroupLaunchSpecification) MarshalJSON() ([]byte, error) { - type noMethod VirtualNodeGroupLaunchSpecification - raw := noMethod(o) - return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) -} - -func (o *VirtualNodeGroupLaunchSpecification) SetOSDisk(v *OSDisk) *VirtualNodeGroupLaunchSpecification { - if o.OSDisk = v; o.OSDisk == nil { - o.nullFields = append(o.nullFields, "OSDisk") - } - return o -} - -func (o *VirtualNodeGroupLaunchSpecification) SetTags(v []*Tag) *VirtualNodeGroupLaunchSpecification { - if o.Tags = v; o.Tags == nil { - o.nullFields = append(o.nullFields, "Tags") - } - return o -} - -func (o *VirtualNodeGroupLaunchSpecification) SetMaxPods(v *int) *VirtualNodeGroupLaunchSpecification { - if o.MaxPods = v; o.MaxPods == nil { - o.nullFields = append(o.nullFields, "MaxPods") - } - return o -} - -// endregion diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/rightsizing.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/rightsizing.go deleted file mode 100644 index acd1f6b884..0000000000 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/rightsizing.go +++ /dev/null @@ -1,134 +0,0 @@ -package azure - -import ( - "context" - "encoding/json" - "io/ioutil" - "net/http" - - "github.com/spotinst/spotinst-sdk-go/spotinst" - "github.com/spotinst/spotinst-sdk-go/spotinst/client" - "github.com/spotinst/spotinst-sdk-go/spotinst/util/uritemplates" -) - -type Filter struct { - Attribute *Attribute `json:"attribute,omitempty"` - Namespaces []string `json:"namespaces,omitempty"` - - forceSendFields []string - nullFields []string -} - -type Attribute struct { - Key *string `json:"key,omitempty"` - Operator *string `json:"operator,omitempty"` - Type *string `json:"type,omitempty"` - Value *string `json:"value,omitempty"` - - forceSendFields []string - nullFields []string -} - -// ResourceSuggestion represents a single resource suggestion. -type ResourceSuggestion struct { - ResourceName *string `json:"resourceName,omitempty"` - ResourceType *string `json:"resourceType,omitempty"` - Namespace *string `json:"namespace,omitempty"` - SuggestedCPU *float64 `json:"suggestedCPU,omitempty"` - RequestedCPU *float64 `json:"requestedCPU,omitempty"` - SuggestedMemory *float64 `json:"suggestedMemory,omitempty"` - RequestedMemory *float64 `json:"requestedMemory,omitempty"` - Containers []*ContainerResourceSuggestion `json:"containers,omitempty"` -} - -// ContainerResourceSuggestion represents a resource suggestion for a -// single container. -type ContainerResourceSuggestion struct { - Name *string `json:"name,omitempty"` - SuggestedCPU *float64 `json:"suggestedCpu,omitempty"` - RequestedCPU *float64 `json:"requestedCpu,omitempty"` - SuggestedMemory *float64 `json:"suggestedMemory,omitempty"` - RequestedMemory *float64 `json:"requestedMemory,omitempty"` -} - -// ListResourceSuggestionsInput represents the input of `ListResourceSuggestions` function. -type ListResourceSuggestionsInput struct { - OceanID *string `json:"oceanId,omitempty"` - Namespace *string `json:"namespace,omitempty"` - Filter *Filter `json:"filter,omitempty"` -} - -// ListResourceSuggestionsOutput represents the output of `ListResourceSuggestions` function. -type ListResourceSuggestionsOutput struct { - Suggestions []*ResourceSuggestion `json:"suggestions,omitempty"` -} - -// region Unmarshallers - -func resourceSuggestionFromJSON(in []byte) (*ResourceSuggestion, error) { - b := new(ResourceSuggestion) - if err := json.Unmarshal(in, b); err != nil { - return nil, err - } - return b, nil -} - -func resourceSuggestionsFromJSON(in []byte) ([]*ResourceSuggestion, error) { - var rw client.Response - if err := json.Unmarshal(in, &rw); err != nil { - return nil, err - } - out := make([]*ResourceSuggestion, len(rw.Response.Items)) - for i, rb := range rw.Response.Items { - b, err := resourceSuggestionFromJSON(rb) - if err != nil { - return nil, err - } - out[i] = b - } - return out, nil -} - -func resourceSuggestionsFromHTTPResponse(resp *http.Response) ([]*ResourceSuggestion, error) { - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - return resourceSuggestionsFromJSON(body) -} - -// endregion - -// region API request - -// ListResourceSuggestions returns a list of right-sizing resource suggestions -// for an Ocean cluster. -func (s *ServiceOp) ListResourceSuggestions(ctx context.Context, input *ListResourceSuggestionsInput) (*ListResourceSuggestionsOutput, error) { - path, err := uritemplates.Expand("/ocean/azure/k8s/cluster/{oceanId}/rightSizing/suggestion", uritemplates.Values{ - "oceanId": spotinst.StringValue(input.OceanID), - }) - if err != nil { - return nil, err - } - - r := client.NewRequest(http.MethodPost, path) - - // We do NOT need the ID anymore, so let's drop it. - input.OceanID = nil - r.Obj = input - - resp, err := client.RequireOK(s.Client.Do(ctx, r)) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - rs, err := resourceSuggestionsFromHTTPResponse(resp) - if err != nil { - return nil, err - } - - return &ListResourceSuggestionsOutput{Suggestions: rs}, nil -} - -//endregion diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/service.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/service.go deleted file mode 100644 index f81ce0739b..0000000000 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure/service.go +++ /dev/null @@ -1,44 +0,0 @@ -package azure - -import ( - "context" - - "github.com/spotinst/spotinst-sdk-go/spotinst" - "github.com/spotinst/spotinst-sdk-go/spotinst/client" - "github.com/spotinst/spotinst-sdk-go/spotinst/session" -) - -// Service provides the API operation methods for making requests to endpoints -// of the Spotinst API. See this package's package overview docs for details on -// the service. -type Service interface { - ListClusters(context.Context) (*ListClustersOutput, error) - CreateCluster(context.Context, *CreateClusterInput) (*CreateClusterOutput, error) - ReadCluster(context.Context, *ReadClusterInput) (*ReadClusterOutput, error) - UpdateCluster(context.Context, *UpdateClusterInput) (*UpdateClusterOutput, error) - DeleteCluster(context.Context, *DeleteClusterInput) (*DeleteClusterOutput, error) - ImportCluster(context.Context, *ImportClusterInput) (*ImportClusterOutput, error) - - ListVirtualNodeGroups(context.Context, *ListVirtualNodeGroupsInput) (*ListVirtualNodeGroupsOutput, error) - CreateVirtualNodeGroup(context.Context, *CreateVirtualNodeGroupInput) (*CreateVirtualNodeGroupOutput, error) - ReadVirtualNodeGroup(context.Context, *ReadVirtualNodeGroupInput) (*ReadVirtualNodeGroupOutput, error) - UpdateVirtualNodeGroup(context.Context, *UpdateVirtualNodeGroupInput) (*UpdateVirtualNodeGroupOutput, error) - DeleteVirtualNodeGroup(context.Context, *DeleteVirtualNodeGroupInput) (*DeleteVirtualNodeGroupOutput, error) - ListResourceSuggestions(context.Context, *ListResourceSuggestionsInput) (*ListResourceSuggestionsOutput, error) -} - -type ServiceOp struct { - Client *client.Client -} - -var _ Service = &ServiceOp{} - -func New(sess *session.Session, cfgs ...*spotinst.Config) *ServiceOp { - cfg := &spotinst.Config{} - cfg.Merge(sess.Config) - cfg.Merge(cfgs...) - - return &ServiceOp{ - Client: client.New(sess.Config), - } -} diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure_np/cluster_np.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure_np/cluster_np.go index 9e29b68113..3dff20c99e 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure_np/cluster_np.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure_np/cluster_np.go @@ -139,6 +139,87 @@ type DeleteClusterInput struct { type DeleteClusterOutput struct{} +type RollSpec struct { + ID *string `json:"id,omitempty"` + ClusterID *string `json:"clusterId,omitempty"` + Comment *string `json:"comment,omitempty"` + Status *string `json:"status,omitempty"` + BatchSizePercentage *int `json:"batchSizePercentage,omitempty"` + BatchMinHealthyPercentage *int `json:"batchMinHealthyPercentage,omitempty"` + RespectPDB *bool `json:"respectPdb,omitempty"` + NodePoolNames []string `json:"nodePoolNames,omitempty"` + VngIds []string `json:"vngIds,omitempty"` + RespectRestrictScaleDown *bool `json:"respectRestrictScaleDown,omitempty"` + NodeNames []string `json:"nodeNames,omitempty"` + + forceSendFields []string + nullFields []string +} + +type RollStatus struct { + ID *string `json:"id,omitempty"` + ClusterID *string `json:"oceanId,omitempty"` + Scope *string `json:"scope,omitempty"` + Comment *string `json:"comment,omitempty"` + Status *string `json:"status,omitempty"` + Progress *Progress `json:"progress,omitempty"` + RespectPDB *bool `json:"respectPdb,omitempty"` + RespectRestrictScaleDown *bool `json:"respectRestrictScaleDown,omitempty"` + BatchMinHealthyPercentage *int `json:"batchMinHealthyPercentage,omitempty"` + CurrentBatch *int `json:"currentBatch,omitempty"` + NumOfBatches *int `json:"numOfBatches,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` +} + +type Progress struct { + ProgressPercentage *float64 `json:"progressPercentage,omitempty"` + DetailedStatus *RollNodes `json:"detailedStatus,omitempty"` +} + +type RollNodes struct { + RollNodes []*NodeStatus `json:"rollNodes,omitempty"` +} + +type NodeStatus struct { + NodeName *string `json:"nodeName,omitempty"` + Status *string `json:"status,omitempty"` +} + +type CreateRollInput struct { + Roll *RollSpec `json:"roll,omitempty"` +} + +type CreateRollOutput struct { + Roll *RollStatus `json:"roll,omitempty"` +} + +type ReadRollInput struct { + RollID *string `json:"rollId,omitempty"` + ClusterID *string `json:"clusterId,omitempty"` +} + +type ReadRollOutput struct { + Roll *RollStatus `json:"roll,omitempty"` +} + +type ListRollsInput struct { + ClusterID *string `json:"clusterId,omitempty"` +} + +type ListRollsOutput struct { + Rolls []*RollStatus `json:"rolls,omitempty"` +} + +type StopRollInput struct { + ClusterID *string `json:"clusterId,omitempty"` + RollID *string `json:"rollId,omitempty"` +} + +type StopRollOutput struct { + Rolls []*RollStatus `json:"rolls,omitempty"` +} + // region Unmarshalls func clusterFromJSON(in []byte) (*Cluster, error) { @@ -295,7 +376,7 @@ func (s *ServiceOp) UpdateCluster(ctx context.Context, input *UpdateClusterInput r := client.NewRequest(http.MethodPut, path) r.Obj = input - + input.Cluster.AKS = nil resp, err := client.RequireOK(s.Client.Do(ctx, r)) if err != nil { return nil, err @@ -576,12 +657,12 @@ func (o Automatic) MarshalJSON() ([]byte, error) { return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) } -/*func (o *Automatic) SetIsEnabled(v *bool) *Automatic { +func (o *Automatic) SetIsEnabled(v *bool) *Automatic { if o.IsEnabled = v; o.IsEnabled == nil { o.nullFields = append(o.nullFields, "IsEnabled") } return o -}*/ +} func (o *Automatic) SetPercentage(v *int) *Automatic { if o.Percentage = v; o.Percentage == nil { @@ -700,4 +781,185 @@ type ImportClusterOutput struct { Cluster *Cluster `json:"cluster,omitempty"` } +type LaunchNewNodesInput struct { + Adjustment *int `json:"adjustment,omitempty"` + ApplicableVmSizes []string `json:"applicableVmSizes,omitempty"` + AvailabilityZones []string `json:"availabilityZones,omitempty"` + MinCoresPerNode *int `json:"minCoresPerNode,omitempty"` + MinMemoryGiBPerNode *float64 `json:"minMemoryGiBPerNode,omitempty"` + OceanId *string `json:"oceanId,omitempty"` + PreferredLifecycle *string `json:"preferredLifecycle,omitempty"` + VngIds []string `json:"vngIds,omitempty"` +} + +type LaunchNewNodesOutput struct{} + +func (s *ServiceOp) LaunchNewNodes(ctx context.Context, + input *LaunchNewNodesInput) (*LaunchNewNodesOutput, error) { + r := client.NewRequest(http.MethodPut, "/ocean/azure/np/cluster/launchNewNodes") + r.Obj = input + + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + return &LaunchNewNodesOutput{}, nil +} + // endregion + +func (s *ServiceOp) CreateRoll(ctx context.Context, input *CreateRollInput) (*CreateRollOutput, error) { + path, err := uritemplates.Expand("/ocean/azure/np/cluster/{clusterId}/roll", uritemplates.Values{ + "clusterId": spotinst.StringValue(input.Roll.ClusterID), + }) + if err != nil { + return nil, err + } + + // We do not need the ID anymore so let's drop it. + input.Roll.ClusterID = nil + + r := client.NewRequest(http.MethodPost, path) + r.Obj = input.Roll + + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + v, err := rollStatusesFromHttpResponse(resp) + if err != nil { + return nil, err + } + + output := new(CreateRollOutput) + if len(v) > 0 { + output.Roll = v[0] + } + + return output, nil +} + +func (s *ServiceOp) ReadRoll(ctx context.Context, input *ReadRollInput) (*ReadRollOutput, error) { + path, err := uritemplates.Expand("/ocean/azure/np/cluster/{clusterId}/roll/{rollId}", uritemplates.Values{ + "clusterId": spotinst.StringValue(input.ClusterID), + "rollId": spotinst.StringValue(input.RollID), + }) + if err != nil { + return nil, err + } + + r := client.NewRequest(http.MethodGet, path) + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + v, err := rollStatusesFromHttpResponse(resp) + if err != nil { + return nil, err + } + + output := new(ReadRollOutput) + if len(v) > 0 { + output.Roll = v[0] + } + + return output, nil +} + +func (s *ServiceOp) ListRolls(ctx context.Context, input *ListRollsInput) (*ListRollsOutput, error) { + path, err := uritemplates.Expand("/ocean/azure/np/cluster/{oceanClusterId}/roll", uritemplates.Values{ + "oceanClusterId": spotinst.StringValue(input.ClusterID), + }) + if err != nil { + return nil, err + } + + r := client.NewRequest(http.MethodGet, path) + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + v, err := rollStatusesFromHttpResponse(resp) + if err != nil { + return nil, err + } + + output := new(ListRollsOutput) + if len(v) > 0 { + output.Rolls = v + } + + return output, nil +} + +func (s *ServiceOp) StopRoll(ctx context.Context, input *StopRollInput) (*StopRollOutput, error) { + path, err := uritemplates.Expand("/ocean/azure/np/cluster/{oceanClusterId}/roll/{rollId}/stop", uritemplates.Values{ + "oceanClusterId": spotinst.StringValue(input.ClusterID), + "rollId": spotinst.StringValue(input.RollID), + }) + if err != nil { + return nil, err + } + + r := client.NewRequest(http.MethodPut, path) + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + v, err := rollStatusesFromHttpResponse(resp) + if err != nil { + return nil, err + } + + output := new(StopRollOutput) + if len(v) > 0 { + output.Rolls = v + } + + return output, nil +} + +func rollStatusesFromHttpResponse(resp *http.Response) ([]*RollStatus, error) { + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + return rollStatusesFromJSON(body) +} + +func rollStatusesFromJSON(in []byte) ([]*RollStatus, error) { + var rw client.Response + if err := json.Unmarshal(in, &rw); err != nil { + return nil, err + } + out := make([]*RollStatus, len(rw.Response.Items)) + if len(out) == 0 { + return out, nil + } + for i, rb := range rw.Response.Items { + b, err := rollStatusFromJSON(rb) + if err != nil { + return nil, err + } + out[i] = b + } + return out, nil +} + +func rollStatusFromJSON(in []byte) (*RollStatus, error) { + b := new(RollStatus) + if err := json.Unmarshal(in, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure_np/common.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure_np/common.go index 7b8046d3bb..a8532efcbe 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure_np/common.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure_np/common.go @@ -4,12 +4,16 @@ import "github.com/spotinst/spotinst-sdk-go/spotinst/util/jsonutil" // NodePoolProperties region type NodePoolProperties struct { - MaxPodsPerNode *int `json:"maxPodsPerNode,omitempty"` - EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"` - OsDiskSizeGB *int `json:"osDiskSizeGB,omitempty"` - OsDiskType *string `json:"osDiskType,omitempty"` - OsType *string `json:"osType,omitempty"` - OsSKU *string `json:"osSKU,omitempty"` + MaxPodsPerNode *int `json:"maxPodsPerNode,omitempty"` + EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"` + OsDiskSizeGB *int `json:"osDiskSizeGB,omitempty"` + OsDiskType *string `json:"osDiskType,omitempty"` + OsType *string `json:"osType,omitempty"` + OsSKU *string `json:"osSKU,omitempty"` + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + PodSubnetIDs []string `json:"podSubnetIDs,omitempty"` + VnetSubnetIDs []string `json:"vnetSubnetIDs,omitempty"` + LinuxOSConfig *LinuxOSConfig `json:"linuxOSConfig,omitempty"` forceSendFields []string nullFields []string @@ -21,6 +25,13 @@ func (o NodePoolProperties) MarshalJSON() ([]byte, error) { return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) } +func (o *NodePoolProperties) SetLinuxOSConfig(v *LinuxOSConfig) *NodePoolProperties { + if o.LinuxOSConfig = v; o.LinuxOSConfig == nil { + o.nullFields = append(o.nullFields, "LinuxOSConfig") + } + return o +} + func (o *NodePoolProperties) SetMaxPodsPerNode(v *int) *NodePoolProperties { if o.MaxPodsPerNode = v; o.MaxPodsPerNode == nil { o.nullFields = append(o.nullFields, "MaxPodsPerNode") @@ -63,8 +74,59 @@ func (o *NodePoolProperties) SetOsSKU(v *string) *NodePoolProperties { return o } +func (o *NodePoolProperties) SetKubernetesVersion(v *string) *NodePoolProperties { + if o.KubernetesVersion = v; o.KubernetesVersion == nil { + o.nullFields = append(o.nullFields, "KubernetesVersion") + } + return o +} + +func (o *NodePoolProperties) SetPodSubnetIDs(v []string) *NodePoolProperties { + if o.PodSubnetIDs = v; o.PodSubnetIDs == nil { + o.nullFields = append(o.nullFields, "PodSubnetIDs") + } + return o +} + +func (o *NodePoolProperties) SetVnetSubnetIDs(v []string) *NodePoolProperties { + if o.VnetSubnetIDs = v; o.VnetSubnetIDs == nil { + o.nullFields = append(o.nullFields, "VnetSubnetIDs") + } + return o +} + // endregion +// LinuxOSConfig region +type LinuxOSConfig struct { + Sysctls *Sysctls `json:"sysctls,omitempty"` + + forceSendFields []string + nullFields []string +} + +func (o *LinuxOSConfig) SetSysctls(v *Sysctls) *LinuxOSConfig { + if o.Sysctls = v; o.Sysctls == nil { + o.nullFields = append(o.nullFields, "Sysctls") + } + return o +} + +// Sysctls region +type Sysctls struct { + VmMaxMapCount *int `json:"vmMaxMapCount,omitempty"` + + forceSendFields []string + nullFields []string +} + +func (o *Sysctls) SetVmMaxMapCount(v *int) *Sysctls { + if o.VmMaxMapCount = v; o.VmMaxMapCount == nil { + o.nullFields = append(o.nullFields, "VmMaxMapCount") + } + return o +} + // NodeCountLimits region type NodeCountLimits struct { MinCount *int `json:"minCount,omitempty"` @@ -243,6 +305,7 @@ func (o *Headrooms) SetNumOfUnits(v *int) *Headrooms { type Scheduling struct { ShutdownHours *ShutdownHours `json:"shutdownHours,omitempty"` + Tasks []*Tasks `json:"tasks,omitempty"` forceSendFields []string nullFields []string @@ -256,6 +319,35 @@ type ShutdownHours struct { nullFields []string } +type Tasks struct { + IsEnabled *bool `json:"isEnabled,omitempty"` + TaskType *string `json:"taskType,omitempty"` + CronExpression *string `json:"cronExpression,omitempty"` + Parameters *Parameters `json:"parameters,omitempty"` + + forceSendFields []string + nullFields []string +} + +type Parameters struct { + ClusterRoll *ParameterClusterRoll `json:"clusterRoll,omitempty"` + + forceSendFields []string + nullFields []string +} + +type ParameterClusterRoll struct { + BatchSizePercentage *int `json:"batchSizePercentage,omitempty"` + Comment *string `json:"comment,omitempty"` + RespectPdb *bool `json:"respectPdb,omitempty"` + RespectRestrictScaleDown *bool `json:"respectRestrictScaleDown,omitempty"` + BatchMinHealthyPercentage *int `json:"batchMinHealthyPercentage,omitempty"` + VngIds []string `json:"vngIds,omitempty"` + + forceSendFields []string + nullFields []string +} + func (o Scheduling) MarshalJSON() ([]byte, error) { type noMethod Scheduling raw := noMethod(o) @@ -301,13 +393,21 @@ type VmSizes struct { } type Filters struct { - MinVcpu *int `json:"minVCpu,omitempty"` - MaxVcpu *int `json:"maxVCpu,omitempty"` - MinMemoryGiB *float64 `json:"minMemoryGiB,omitempty"` - MaxMemoryGiB *float64 `json:"maxMemoryGiB,omitempty"` - Series []string `json:"series,omitempty"` - Architectures []string `json:"architectures,omitempty"` - ExcludeSeries []string `json:"excludeSeries,omitempty"` + MinVcpu *int `json:"minVCpu,omitempty"` + MaxVcpu *int `json:"maxVCpu,omitempty"` + MinMemoryGiB *float64 `json:"minMemoryGiB,omitempty"` + MaxMemoryGiB *float64 `json:"maxMemoryGiB,omitempty"` + Series []string `json:"series,omitempty"` + Architectures []string `json:"architectures,omitempty"` + ExcludeSeries []string `json:"excludeSeries,omitempty"` + AcceleratedNetworking *string `json:"acceleratedNetworking,omitempty"` + DiskPerformance *string `json:"diskPerformance,omitempty"` + MinGpu *float64 `json:"minGpu,omitempty"` + MaxGpu *float64 `json:"maxGpu,omitempty"` + MinNICs *int `json:"minNICs,omitempty"` + VmTypes []string `json:"vmTypes,omitempty"` + MinDisk *int `json:"minDisk,omitempty"` + GpuTypes []string `json:"gpuTypes,omitempty"` forceSendFields []string nullFields []string @@ -385,4 +485,175 @@ func (o *Filters) SetExcludeSeries(v []string) *Filters { return o } +func (o *Filters) SetAcceleratedNetworking(v *string) *Filters { + if o.AcceleratedNetworking = v; o.AcceleratedNetworking == nil { + o.nullFields = append(o.nullFields, "AcceleratedNetworking") + } + return o +} + +func (o *Filters) SetDiskPerformance(v *string) *Filters { + if o.DiskPerformance = v; o.DiskPerformance == nil { + o.nullFields = append(o.nullFields, "DiskPerformance") + } + return o +} + +func (o *Filters) SetMinGpu(v *float64) *Filters { + if o.MinGpu = v; o.MinGpu == nil { + o.nullFields = append(o.nullFields, "MinGpu") + } + return o +} + +func (o *Filters) SetMaxGpu(v *float64) *Filters { + if o.MaxGpu = v; o.MaxGpu == nil { + o.nullFields = append(o.nullFields, "MaxGpu") + } + return o +} + +func (o *Filters) SetMinNICs(v *int) *Filters { + if o.MinNICs = v; o.MinNICs == nil { + o.nullFields = append(o.nullFields, "MinNICs") + } + return o +} + +func (o *Filters) SetVmTypes(v []string) *Filters { + if o.VmTypes = v; o.VmTypes == nil { + o.nullFields = append(o.nullFields, "VmTypes") + } + return o +} + +func (o *Filters) SetMinDisk(v *int) *Filters { + if o.MinDisk = v; o.MinDisk == nil { + o.nullFields = append(o.nullFields, "MinDisk") + } + return o +} + +func (o *Filters) SetGpuTypes(v []string) *Filters { + if o.GpuTypes = v; o.GpuTypes == nil { + o.nullFields = append(o.nullFields, "GpuTypes") + } + return o +} + //end region + +// region Tasks + +func (o *Scheduling) SetTasks(v []*Tasks) *Scheduling { + if o.Tasks = v; o.Tasks == nil { + o.nullFields = append(o.nullFields, "Tasks") + } + return o +} + +func (o Tasks) MarshalJSON() ([]byte, error) { + type noMethod Tasks + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *Tasks) SetIsEnabled(v *bool) *Tasks { + if o.IsEnabled = v; o.IsEnabled == nil { + o.nullFields = append(o.nullFields, "IsEnabled") + } + return o +} + +func (o *Tasks) SetTaskType(v *string) *Tasks { + if o.TaskType = v; o.TaskType == nil { + o.nullFields = append(o.nullFields, "Type") + } + return o +} + +func (o *Tasks) SetCronExpression(v *string) *Tasks { + if o.CronExpression = v; o.CronExpression == nil { + o.nullFields = append(o.nullFields, "CronExpression") + } + return o +} + +// endregion + +// region Parameters +func (o Parameters) MarshalJSON() ([]byte, error) { + type noMethod Parameters + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *Tasks) SetParameters(v *Parameters) *Tasks { + if o.Parameters = v; o.Parameters == nil { + o.nullFields = append(o.nullFields, "Parameter") + } + return o +} + +// endregion + +// region ClusterRoll +func (o *Parameters) SetClusterRoll(v *ParameterClusterRoll) *Parameters { + if o.ClusterRoll = v; o.ClusterRoll == nil { + o.nullFields = append(o.nullFields, "ClusterRoll") + } + return o +} + +func (o ParameterClusterRoll) MarshalJSON() ([]byte, error) { + type noMethod ParameterClusterRoll + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +// endregion + +// region ParameterClusterRoll +func (o *ParameterClusterRoll) SetBatchSizePercentage(v *int) *ParameterClusterRoll { + if o.BatchSizePercentage = v; o.BatchSizePercentage == nil { + o.nullFields = append(o.nullFields, "BatchSizePercentage") + } + return o +} + +func (o *ParameterClusterRoll) SetComment(v *string) *ParameterClusterRoll { + if o.Comment = v; o.Comment == nil { + o.nullFields = append(o.nullFields, "Comment") + } + return o +} + +func (o *ParameterClusterRoll) SetRespectPdb(v *bool) *ParameterClusterRoll { + if o.RespectPdb = v; o.RespectPdb == nil { + o.nullFields = append(o.nullFields, "RespectPdb") + } + return o +} + +func (o *ParameterClusterRoll) SetRespectRestrictScaleDown(v *bool) *ParameterClusterRoll { + if o.RespectRestrictScaleDown = v; o.RespectRestrictScaleDown == nil { + o.nullFields = append(o.nullFields, "RespectRestrictScaleDown") + } + return o +} + +func (o *ParameterClusterRoll) SetBatchMinHealthyPercentage(v *int) *ParameterClusterRoll { + if o.BatchMinHealthyPercentage = v; o.BatchMinHealthyPercentage == nil { + o.nullFields = append(o.nullFields, "BatchMinHealthyPercentage") + } + return o +} + +func (o *ParameterClusterRoll) SetVngIds(v []string) *ParameterClusterRoll { + if o.VngIds = v; o.VngIds == nil { + o.nullFields = append(o.nullFields, "VngIds") + } + return o +} + +// endregion diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure_np/service.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure_np/service.go index fafbbd59c8..a0038584cc 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure_np/service.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure_np/service.go @@ -17,12 +17,17 @@ type Service interface { UpdateCluster(context.Context, *UpdateClusterInput) (*UpdateClusterOutput, error) DeleteCluster(context.Context, *DeleteClusterInput) (*DeleteClusterOutput, error) ImportCluster(context.Context, *ImportClusterInput) (*ImportClusterOutput, error) + CreateRoll(context.Context, *CreateRollInput) (*CreateRollOutput, error) + ReadRoll(ctx context.Context, input *ReadRollInput) (*ReadRollOutput, error) + ListRolls(ctx context.Context, input *ListRollsInput) (*ListRollsOutput, error) + StopRoll(ctx context.Context, input *StopRollInput) (*StopRollOutput, error) ListVirtualNodeGroups(context.Context, *ListVirtualNodeGroupsInput) (*ListVirtualNodeGroupsOutput, error) CreateVirtualNodeGroup(context.Context, *CreateVirtualNodeGroupInput) (*CreateVirtualNodeGroupOutput, error) ReadVirtualNodeGroup(context.Context, *ReadVirtualNodeGroupInput) (*ReadVirtualNodeGroupOutput, error) UpdateVirtualNodeGroup(context.Context, *UpdateVirtualNodeGroupInput) (*UpdateVirtualNodeGroupOutput, error) DeleteVirtualNodeGroup(context.Context, *DeleteVirtualNodeGroupInput) (*DeleteVirtualNodeGroupOutput, error) + LaunchNewNodes(context.Context, *LaunchNewNodesInput) (*LaunchNewNodesOutput, error) } type ServiceOp struct { diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/gcp/cluster.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/gcp/cluster.go index 81ce45f01c..11ed20a073 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/gcp/cluster.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/gcp/cluster.go @@ -46,9 +46,10 @@ type Cluster struct { } type Strategy struct { - DrainingTimeout *int `json:"drainingTimeout,omitempty"` - ProvisioningModel *string `json:"provisioningModel,omitempty"` - PreemptiblePercentage *int `json:"preemptiblePercentage,omitempty"` + DrainingTimeout *int `json:"drainingTimeout,omitempty"` + ProvisioningModel *string `json:"provisioningModel,omitempty"` + PreemptiblePercentage *int `json:"preemptiblePercentage,omitempty"` + ShouldUtilizeCommitments *bool `json:"shouldUtilizeCommitments,omitempty"` forceSendFields []string nullFields []string @@ -877,6 +878,13 @@ func (o *Strategy) SetPreemptiblePercentage(v *int) *Strategy { return o } +func (o *Strategy) SetShouldUtilizeCommitments(v *bool) *Strategy { + if o.ShouldUtilizeCommitments = v; o.ShouldUtilizeCommitments == nil { + o.nullFields = append(o.nullFields, "ShouldUtilizeCommitments") + } + return o +} + // endregion // region Compute diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/gcp/launchspec.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/gcp/launchspec.go index 7e8f069ae4..a0e833a007 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/gcp/launchspec.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/providers/gcp/launchspec.go @@ -5,6 +5,7 @@ import ( "encoding/json" "io/ioutil" "net/http" + "strconv" "github.com/spotinst/spotinst-sdk-go/spotinst" "github.com/spotinst/spotinst-sdk-go/spotinst/client" @@ -184,7 +185,8 @@ type ListLaunchSpecsOutput struct { } type CreateLaunchSpecInput struct { - LaunchSpec *LaunchSpec `json:"launchSpec,omitempty"` + LaunchSpec *LaunchSpec `json:"launchSpec,omitempty"` + InitialNodes *int `json:"-"` } type CreateLaunchSpecOutput struct { @@ -273,6 +275,10 @@ func (s *ServiceOp) CreateLaunchSpec(ctx context.Context, input *CreateLaunchSpe r := client.NewRequest(http.MethodPost, "/ocean/gcp/k8s/launchSpec") r.Obj = input + if input.InitialNodes != nil { + r.Params.Set("initialNodes", strconv.Itoa(spotinst.IntValue(input.InitialNodes))) + } + resp, err := client.RequireOK(s.Client.Do(ctx, r)) if err != nil { return nil, err diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/right_sizing/right_sizing.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/right_sizing/right_sizing.go new file mode 100644 index 0000000000..7714a03da0 --- /dev/null +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/right_sizing/right_sizing.go @@ -0,0 +1,675 @@ +package right_sizing + +import ( + "context" + "encoding/json" + "github.com/spotinst/spotinst-sdk-go/spotinst" + "github.com/spotinst/spotinst-sdk-go/spotinst/client" + "github.com/spotinst/spotinst-sdk-go/spotinst/util/jsonutil" + "github.com/spotinst/spotinst-sdk-go/spotinst/util/uritemplates" + "io/ioutil" + "net/http" +) + +type RightsizingRule struct { + RuleName *string `json:"ruleName,omitempty"` + OceanId *string `json:"oceanId,omitempty"` + RestartReplicas *string `json:"restartReplicas,omitempty"` + ExcludePreliminaryRecommendations *bool `json:"excludePreliminaryRecommendations,omitempty"` + RecommendationApplicationIntervals []*RecommendationApplicationIntervals `json:"recommendationApplicationIntervals,omitempty"` + RecommendationApplicationMinThreshold *RecommendationApplicationMinThreshold `json:"recommendationApplicationMinThreshold,omitempty"` + RecommendationApplicationBoundaries *RecommendationApplicationBoundaries `json:"recommendationApplicationBoundaries,omitempty"` + RecommendationApplicationOverheadValues *RecommendationApplicationOverheadValues `json:"recommendationApplicationOverheadValues,omitempty"` + RecommendationApplicationHPA *RecommendationApplicationHPA `json:"recommendationApplicationHPA,omitempty"` + + forceSendFields []string + nullFields []string +} + +type RecommendationApplicationIntervals struct { + RepetitionBasis *string `json:"repetitionBasis,omitempty"` + WeeklyRepetitionBasis *WeeklyRepetitionBasis `json:"weeklyRepetitionBasis,omitempty"` + MonthlyRepetitionBasis *MonthlyRepetitionBasis `json:"monthlyRepetitionBasis,omitempty"` + + forceSendFields []string + nullFields []string +} + +type WeeklyRepetitionBasis struct { + IntervalDays []string `json:"intervalDays,omitempty"` + IntervalHours *IntervalHours `json:"intervalHours,omitempty"` + + forceSendFields []string + nullFields []string +} + +type MonthlyRepetitionBasis struct { + IntervalMonths []int `json:"intervalMonths,omitempty"` + WeekOfTheMonth []string `json:"weekOfTheMonth,omitempty"` + WeeklyRepetitionBasis *WeeklyRepetitionBasis `json:"weeklyRepetitionBasis,omitempty"` + + forceSendFields []string + nullFields []string +} + +type IntervalHours struct { + StartTime *string `json:"startTime,omitempty"` + EndTime *string `json:"endTime,omitempty"` + + forceSendFields []string + nullFields []string +} + +type RecommendationApplicationMinThreshold struct { + CpuPercentage *float64 `json:"cpuPercentage,omitempty"` + MemoryPercentage *float64 `json:"memoryPercentage,omitempty"` + + forceSendFields []string + nullFields []string +} + +type RecommendationApplicationBoundaries struct { + Cpu *Cpu `json:"cpu,omitempty"` + Memory *Memory `json:"memory,omitempty"` + + forceSendFields []string + nullFields []string +} + +type Cpu struct { + Min *float64 `json:"min,omitempty"` + Max *float64 `json:"max,omitempty"` + + forceSendFields []string + nullFields []string +} + +type Memory struct { + Min *int `json:"min,omitempty"` + Max *int `json:"max,omitempty"` + + forceSendFields []string + nullFields []string +} +type Label struct { + Key *string `json:"key,omitempty"` + Value *string `json:"value,omitempty"` + + forceSendFields []string + nullFields []string +} + +type Namespace struct { + NamespaceName *string `json:"namespaceName,omitempty"` + Workloads []*Workload `json:"workloads,omitempty"` + Labels []*Label `json:"labels,omitempty"` + + forceSendFields []string + nullFields []string +} + +type Workload struct { + Name *string `json:"name,omitempty"` + WorkloadType *string `json:"workloadType,omitempty"` + RegexName *string `json:"regexName,omitempty"` + + forceSendFields []string + nullFields []string +} + +type RecommendationApplicationOverheadValues struct { + CpuPercentage *float64 `json:"cpuPercentage,omitempty"` + MemoryPercentage *float64 `json:"memoryPercentage,omitempty"` + + forceSendFields []string + nullFields []string +} + +type RecommendationApplicationHPA struct { + AllowHPARecommendations *bool `json:"allowHPARecommendations,omitempty"` + + forceSendFields []string + nullFields []string +} + +type ListRightsizingRulesInput struct { + OceanId *string `json:"oceanId,omitempty"` +} + +type ListRightsizingRulesOutput struct { + RightsizingRules []*RightsizingRule `json:"rightsizingRule,omitempty"` +} + +type RightSizingAttachDetachInput struct { + RuleName *string `json:"ruleName,omitempty"` + OceanId *string `json:"oceanId,omitempty"` + Namespaces []*Namespace `json:"namespaces,omitempty"` +} + +type RightSizingAttachDetachOutput struct{} + +type ReadRightsizingRuleInput struct { + RuleName *string `json:"ruleName,omitempty"` + OceanId *string `json:"oceanId,omitempty"` +} + +type ReadRightsizingRuleOutput struct { + RightsizingRule *RightsizingRule `json:"rightsizingRule,omitempty"` +} + +type UpdateRightsizingRuleInput struct { + RuleName *string `json:"ruleName,omitempty"` + RightsizingRule *RightsizingRule `json:"rightsizingRule,omitempty"` +} + +type UpdateRightsizingRuleOutput struct { + RightsizingRule *RightsizingRule `json:"rightsizingRule,omitempty"` +} + +type DeleteRightsizingRuleInput struct { + RuleNames []string `json:"ruleNames,omitempty"` + OceanId *string `json:"oceanId,omitempty"` +} + +type DeleteRightsizingRuleOutput struct{} + +type CreateRightsizingRuleInput struct { + RightsizingRule *RightsizingRule `json:"rightsizingRule,omitempty"` +} + +type CreateRightsizingRuleOutput struct { + RightsizingRule *RightsizingRule `json:"rightsizingRule,omitempty"` +} + +func rightsizingRuleFromJSON(in []byte) (*RightsizingRule, error) { + b := new(RightsizingRule) + if err := json.Unmarshal(in, b); err != nil { + return nil, err + } + return b, nil +} + +func rightsizingRulesFromJSON(in []byte) ([]*RightsizingRule, error) { + var rw client.Response + if err := json.Unmarshal(in, &rw); err != nil { + return nil, err + } + out := make([]*RightsizingRule, len(rw.Response.Items)) + if len(out) == 0 { + return out, nil + } + for i, rb := range rw.Response.Items { + b, err := rightsizingRuleFromJSON(rb) + if err != nil { + return nil, err + } + out[i] = b + } + return out, nil +} + +func rightsizingRulesFromHttpResponse(resp *http.Response) ([]*RightsizingRule, error) { + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + return rightsizingRulesFromJSON(body) +} + +func (s *ServiceOp) ListRightsizingRules(ctx context.Context, input *ListRightsizingRulesInput) (*ListRightsizingRulesOutput, error) { + path, err := uritemplates.Expand("/ocean/{oceanId}/rightSizing/rule", uritemplates.Values{ + "oceanId": spotinst.StringValue(input.OceanId), + }) + if err != nil { + return nil, err + } + + r := client.NewRequest(http.MethodGet, path) + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + gs, err := rightsizingRulesFromHttpResponse(resp) + if err != nil { + return nil, err + } + + return &ListRightsizingRulesOutput{RightsizingRules: gs}, nil +} + +func (s *ServiceOp) CreateRightsizingRule(ctx context.Context, input *CreateRightsizingRuleInput) (*CreateRightsizingRuleOutput, error) { + path, err := uritemplates.Expand("/ocean/{oceanId}/rightSizing/rule", uritemplates.Values{ + "oceanId": spotinst.StringValue(input.RightsizingRule.OceanId), + }) + if err != nil { + return nil, err + } + + // We do NOT need the ID anymore, so let's drop it. + input.RightsizingRule.OceanId = nil + r := client.NewRequest(http.MethodPost, path) + r.Obj = input.RightsizingRule + + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + gs, err := rightsizingRulesFromHttpResponse(resp) + if err != nil { + return nil, err + } + + output := new(CreateRightsizingRuleOutput) + if len(gs) > 0 { + output.RightsizingRule = gs[0] + } + + return output, nil +} + +func (s *ServiceOp) ReadRightsizingRule(ctx context.Context, input *ReadRightsizingRuleInput) (*ReadRightsizingRuleOutput, error) { + path, err := uritemplates.Expand("/ocean/{oceanId}/rightSizing/rule/{ruleName}", uritemplates.Values{ + "oceanId": spotinst.StringValue(input.OceanId), + "ruleName": spotinst.StringValue(input.RuleName), + }) + + if err != nil { + return nil, err + } + + r := client.NewRequest(http.MethodGet, path) + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + gs, err := rightsizingRulesFromHttpResponse(resp) + if err != nil { + return nil, err + } + + output := new(ReadRightsizingRuleOutput) + if len(gs) > 0 { + output.RightsizingRule = gs[0] + } + + return output, nil +} + +func (s *ServiceOp) UpdateRightsizingRule(ctx context.Context, input *UpdateRightsizingRuleInput) (*UpdateRightsizingRuleOutput, error) { + path, err := uritemplates.Expand("/ocean/{oceanId}/rightSizing/rule/{ruleName}", uritemplates.Values{ + "oceanId": spotinst.StringValue(input.RightsizingRule.OceanId), + "ruleName": spotinst.StringValue(input.RuleName), + }) + if err != nil { + return nil, err + } + + input.RightsizingRule.OceanId = nil + + r := client.NewRequest(http.MethodPut, path) + r.Obj = input.RightsizingRule + input.RuleName = nil + + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + gs, err := rightsizingRulesFromHttpResponse(resp) + if err != nil { + return nil, err + } + + output := new(UpdateRightsizingRuleOutput) + if len(gs) > 0 { + output.RightsizingRule = gs[0] + } + + return output, nil +} + +func (s *ServiceOp) DeleteRightsizingRules(ctx context.Context, input *DeleteRightsizingRuleInput) (*DeleteRightsizingRuleOutput, error) { + path, err := uritemplates.Expand("/ocean/{oceanId}/rightSizing/rule", uritemplates.Values{ + "oceanId": spotinst.StringValue(input.OceanId), + }) + if err != nil { + return nil, err + } + + // We do NOT need the ID anymore, so let's drop it. + input.OceanId = nil + + r := client.NewRequest(http.MethodDelete, path) + r.Obj = input + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + return &DeleteRightsizingRuleOutput{}, nil +} + +func (s *ServiceOp) AttachRightSizingRule(ctx context.Context, input *RightSizingAttachDetachInput) (*RightSizingAttachDetachOutput, error) { + path, err := uritemplates.Expand("/ocean/{oceanId}/rightSizing/rule/{ruleName}/attachment", uritemplates.Values{ + "oceanId": spotinst.StringValue(input.OceanId), + "ruleName": spotinst.StringValue(input.RuleName), + }) + + r := client.NewRequest(http.MethodPost, path) + + input.OceanId = nil + input.RuleName = nil + + r.Obj = input + + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + return &RightSizingAttachDetachOutput{}, nil +} + +func (s *ServiceOp) DetachRightSizingRule(ctx context.Context, input *RightSizingAttachDetachInput) (*RightSizingAttachDetachOutput, error) { + path, err := uritemplates.Expand("/ocean/{oceanId}/rightSizing/rule/{ruleName}/detachment", uritemplates.Values{ + "oceanId": spotinst.StringValue(input.OceanId), + "ruleName": spotinst.StringValue(input.RuleName), + }) + + r := client.NewRequest(http.MethodPost, path) + + input.OceanId = nil + input.RuleName = nil + + r.Obj = input + + resp, err := client.RequireOK(s.Client.Do(ctx, r)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + return &RightSizingAttachDetachOutput{}, nil +} + +// region RightsizingRule + +func (o RightsizingRule) MarshalJSON() ([]byte, error) { + type noMethod RightsizingRule + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *RightsizingRule) SetRuleName(v *string) *RightsizingRule { + if o.RuleName = v; o.RuleName == nil { + o.nullFields = append(o.nullFields, "RuleName") + } + return o +} + +func (o *RightsizingRule) SetOceanId(v *string) *RightsizingRule { + if o.OceanId = v; o.OceanId == nil { + o.nullFields = append(o.nullFields, "oceanId") + } + return o +} + +func (o *RightsizingRule) SetRestartReplicas(v *string) *RightsizingRule { + if o.RestartReplicas = v; o.RestartReplicas == nil { + o.nullFields = append(o.nullFields, "RestartReplicas") + } + return o +} + +func (o *RightsizingRule) SetExcludePreliminaryRecommendations(v *bool) *RightsizingRule { + if o.ExcludePreliminaryRecommendations = v; o.ExcludePreliminaryRecommendations == nil { + o.nullFields = append(o.nullFields, "ExcludePreliminaryRecommendations") + } + return o +} + +func (o *RightsizingRule) SetRecommendationApplicationIntervals(v []*RecommendationApplicationIntervals) *RightsizingRule { + if o.RecommendationApplicationIntervals = v; o.RecommendationApplicationIntervals == nil { + o.nullFields = append(o.nullFields, "RecommendationApplicationIntervals") + } + return o +} + +func (o *RightsizingRule) SetRecommendationApplicationBoundaries(v *RecommendationApplicationBoundaries) *RightsizingRule { + if o.RecommendationApplicationBoundaries = v; o.RecommendationApplicationBoundaries == nil { + o.nullFields = append(o.nullFields, "RecommendationApplicationBoundaries") + } + return o +} + +func (o *RightsizingRule) SetRecommendationApplicationMinThreshold(v *RecommendationApplicationMinThreshold) *RightsizingRule { + if o.RecommendationApplicationMinThreshold = v; o.RecommendationApplicationMinThreshold == nil { + o.nullFields = append(o.nullFields, "RecommendationApplicationMinThreshold") + } + return o +} + +func (o *RightsizingRule) SetRecommendationApplicationOverheadValues(v *RecommendationApplicationOverheadValues) *RightsizingRule { + if o.RecommendationApplicationOverheadValues = v; o.RecommendationApplicationOverheadValues == nil { + o.nullFields = append(o.nullFields, "RecommendationApplicationOverheadValues") + } + return o +} + +func (o *RightsizingRule) SetRecommendationApplicationHPA(v *RecommendationApplicationHPA) *RightsizingRule { + if o.RecommendationApplicationHPA = v; o.RecommendationApplicationHPA == nil { + o.nullFields = append(o.nullFields, "RecommendationApplicationHPA") + } + return o +} + +// region RecommendationApplicationInterval + +func (o RecommendationApplicationIntervals) MarshalJSON() ([]byte, error) { + type noMethod RecommendationApplicationIntervals + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *RecommendationApplicationIntervals) SetRepetitionBasis(v *string) *RecommendationApplicationIntervals { + if o.RepetitionBasis = v; o.RepetitionBasis == nil { + o.nullFields = append(o.nullFields, "RepetitionBasis") + } + return o +} + +func (o *RecommendationApplicationIntervals) SetWeeklyRepetitionBasis(v *WeeklyRepetitionBasis) *RecommendationApplicationIntervals { + if o.WeeklyRepetitionBasis = v; o.WeeklyRepetitionBasis == nil { + o.nullFields = append(o.nullFields, "WeeklyRepetitionBasis") + } + return o +} + +func (o *RecommendationApplicationIntervals) SetMonthlyRepetitionBasis(v *MonthlyRepetitionBasis) *RecommendationApplicationIntervals { + if o.MonthlyRepetitionBasis = v; o.MonthlyRepetitionBasis == nil { + o.nullFields = append(o.nullFields, "MonthlyRepetitionBasis") + } + return o +} + +// region WeeklyRepetitionBasis + +func (o *WeeklyRepetitionBasis) SetIntervalDays(v []string) *WeeklyRepetitionBasis { + if o.IntervalDays = v; o.IntervalDays == nil { + o.nullFields = append(o.nullFields, "IntervalDays") + } + return o +} + +func (o *WeeklyRepetitionBasis) SetIntervalHours(v *IntervalHours) *WeeklyRepetitionBasis { + if o.IntervalHours = v; o.IntervalHours == nil { + o.nullFields = append(o.nullFields, "IntervalHours") + } + return o +} + +// region IntervalHours + +func (o *IntervalHours) SetStartTime(v *string) *IntervalHours { + if o.StartTime = v; o.StartTime == nil { + o.nullFields = append(o.nullFields, "StartTime") + } + return o +} + +func (o *IntervalHours) SetEndTime(v *string) *IntervalHours { + if o.EndTime = v; o.EndTime == nil { + o.nullFields = append(o.nullFields, "EndTime") + } + return o +} + +// region MonthlyRepetitionBasis + +func (o *MonthlyRepetitionBasis) SetIntervalMonths(v []int) *MonthlyRepetitionBasis { + if o.IntervalMonths = v; o.IntervalMonths == nil { + o.nullFields = append(o.nullFields, "IntervalMonths") + } + return o +} + +func (o *MonthlyRepetitionBasis) SetWeekOfTheMonth(v []string) *MonthlyRepetitionBasis { + if o.WeekOfTheMonth = v; o.WeekOfTheMonth == nil { + o.nullFields = append(o.nullFields, "WeekOfTheMonth") + } + return o +} + +func (o *MonthlyRepetitionBasis) SetMonthlyWeeklyRepetitionBasis(v *WeeklyRepetitionBasis) *MonthlyRepetitionBasis { + if o.WeeklyRepetitionBasis = v; o.WeeklyRepetitionBasis == nil { + o.nullFields = append(o.nullFields, "WeeklyRepetitionBasis") + } + return o +} + +// region RecommendationApplicationBoundaries +func (o RecommendationApplicationBoundaries) MarshalJSON() ([]byte, error) { + type noMethod RecommendationApplicationBoundaries + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} +func (o *RecommendationApplicationBoundaries) SetCpu(v *Cpu) *RecommendationApplicationBoundaries { + if o.Cpu = v; o.Cpu == nil { + o.nullFields = append(o.nullFields, "Cpu") + } + return o +} + +func (o *RecommendationApplicationBoundaries) SetMemory(v *Memory) *RecommendationApplicationBoundaries { + if o.Memory = v; o.Memory == nil { + o.nullFields = append(o.nullFields, "Memory") + } + return o +} + +// region Cpu +func (o Cpu) MarshalJSON() ([]byte, error) { + type noMethod Cpu + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *Cpu) SetMin(v *float64) *Cpu { + if o.Min = v; o.Min == nil { + o.nullFields = append(o.nullFields, "Cpu") + } + return o +} + +func (o *Cpu) SetMax(v *float64) *Cpu { + if o.Max = v; o.Min == nil { + o.nullFields = append(o.nullFields, "Cpu") + } + return o +} + +// region Memory +func (o Memory) MarshalJSON() ([]byte, error) { + type noMethod Memory + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *Memory) SetMin(v *int) *Memory { + if o.Min = v; o.Min == nil { + o.nullFields = append(o.nullFields, "Memory") + } + return o +} + +func (o *Memory) SetMax(v *int) *Memory { + if o.Max = v; o.Max == nil { + o.nullFields = append(o.nullFields, "Memory") + } + return o +} + +// region RecommendationApplicationMinThreshold +func (o RecommendationApplicationMinThreshold) MarshalJSON() ([]byte, error) { + type noMethod RecommendationApplicationMinThreshold + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *RecommendationApplicationMinThreshold) SetCpuPercentage(v *float64) *RecommendationApplicationMinThreshold { + if o.CpuPercentage = v; o.CpuPercentage == nil { + o.nullFields = append(o.nullFields, "CpuPercentage") + } + return o +} + +func (o *RecommendationApplicationMinThreshold) SetMemoryPercentage(v *float64) *RecommendationApplicationMinThreshold { + if o.MemoryPercentage = v; o.MemoryPercentage == nil { + o.nullFields = append(o.nullFields, "MemoryPercentage") + } + return o +} + +// region RecommendationApplicationOverheadValues +func (o RecommendationApplicationOverheadValues) MarshalJSON() ([]byte, error) { + type noMethod RecommendationApplicationOverheadValues + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *RecommendationApplicationOverheadValues) SetOverheadCpuPercentage(v *float64) *RecommendationApplicationOverheadValues { + if o.CpuPercentage = v; o.CpuPercentage == nil { + o.nullFields = append(o.nullFields, "CpuPercentage") + } + return o +} + +func (o *RecommendationApplicationOverheadValues) SetOverheadMemoryPercentage(v *float64) *RecommendationApplicationOverheadValues { + if o.MemoryPercentage = v; o.MemoryPercentage == nil { + o.nullFields = append(o.nullFields, "MemoryPercentage") + } + return o +} + +// region RecommendationApplicationHPA +func (o RecommendationApplicationHPA) MarshalJSON() ([]byte, error) { + type noMethod RecommendationApplicationHPA + raw := noMethod(o) + return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields) +} + +func (o *RecommendationApplicationHPA) SetAllowHPARecommendations(v *bool) *RecommendationApplicationHPA { + if o.AllowHPARecommendations = v; o.AllowHPARecommendations == nil { + o.nullFields = append(o.nullFields, "AllowHPARecommendations") + } + return o +} diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/right_sizing/service.go b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/right_sizing/service.go new file mode 100644 index 0000000000..c6c68dd2fa --- /dev/null +++ b/vendor/github.com/spotinst/spotinst-sdk-go/service/ocean/right_sizing/service.go @@ -0,0 +1,38 @@ +package right_sizing + +import ( + "context" + + "github.com/spotinst/spotinst-sdk-go/spotinst" + "github.com/spotinst/spotinst-sdk-go/spotinst/client" + "github.com/spotinst/spotinst-sdk-go/spotinst/session" +) + +// Service provides the API operation methods for making requests to endpoints +// of the Spotinst API. See this package's package overview docs for details on +// the service. +type Service interface { + CreateRightsizingRule(context.Context, *CreateRightsizingRuleInput) (*CreateRightsizingRuleOutput, error) + ReadRightsizingRule(context.Context, *ReadRightsizingRuleInput) (*ReadRightsizingRuleOutput, error) + ListRightsizingRules(context.Context, *ListRightsizingRulesInput) (*ListRightsizingRulesOutput, error) + UpdateRightsizingRule(context.Context, *UpdateRightsizingRuleInput) (*UpdateRightsizingRuleOutput, error) + DeleteRightsizingRules(context.Context, *DeleteRightsizingRuleInput) (*DeleteRightsizingRuleOutput, error) + AttachRightSizingRule(context.Context, *RightSizingAttachDetachInput) (*RightSizingAttachDetachOutput, error) + DetachRightSizingRule(context.Context, *RightSizingAttachDetachInput) (*RightSizingAttachDetachOutput, error) +} + +type ServiceOp struct { + Client *client.Client +} + +var _ Service = &ServiceOp{} + +func New(sess *session.Session, cfgs ...*spotinst.Config) *ServiceOp { + cfg := &spotinst.Config{} + cfg.Merge(sess.Config) + cfg.Merge(cfgs...) + + return &ServiceOp{ + Client: client.New(sess.Config), + } +} diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/spotinst/client/client.go b/vendor/github.com/spotinst/spotinst-sdk-go/spotinst/client/client.go index 0c448d96cb..4e2db7c1cb 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/spotinst/client/client.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/spotinst/client/client.go @@ -79,3 +79,15 @@ func (c *Client) logResponse(resp *http.Response) { } } } + +// Do runs a request with our client. +func (c *Client) DoOrg(ctx context.Context, r *Request) (*http.Response, error) { + req, err := r.toHTTPOrg(ctx, c.config) + if err != nil { + return nil, err + } + c.logRequest(req) + resp, err := c.config.HTTPClient.Do(req) + c.logResponse(resp) + return resp, err +} diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/spotinst/client/request.go b/vendor/github.com/spotinst/spotinst-sdk-go/spotinst/client/request.go index efbe32f946..f00a68fcf8 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/spotinst/client/request.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/spotinst/client/request.go @@ -74,3 +74,46 @@ func EncodeBody(obj interface{}) (io.Reader, error) { } return buf, nil } + +// toHTTP converts the request to an HTTP request. +func (r *Request) toHTTPOrg(ctx context.Context, cfg *spotinst.Config) (*http.Request, error) { + // Set the user credentials. + creds, err := cfg.Credentials.Get() + if err != nil { + return nil, err + } + if creds.Token != "" { + r.header.Set("Authorization", "Bearer "+creds.Token) + } + + // Encode the query parameters. + r.url.RawQuery = r.Params.Encode() + + // Check if we should encode the body. + if r.body == nil && r.Obj != nil { + if b, err := EncodeBody(r.Obj); err != nil { + return nil, err + } else { + r.body = b + } + } + + // Create the HTTP request. + req, err := http.NewRequest(r.method, r.url.RequestURI(), r.body) + if err != nil { + return nil, err + } + + // Set request base URL. + req.URL.Host = cfg.BaseURL.Host + req.URL.Scheme = cfg.BaseURL.Scheme + + // Set request headers. + req.Host = cfg.BaseURL.Host + req.Header = r.header + req.Header.Set("Content-Type", cfg.ContentType) + req.Header.Add("Accept", cfg.ContentType) + req.Header.Add("User-Agent", cfg.UserAgent) + + return req.WithContext(ctx), nil +} diff --git a/vendor/github.com/spotinst/spotinst-sdk-go/spotinst/version.go b/vendor/github.com/spotinst/spotinst-sdk-go/spotinst/version.go index b993929578..2346bb824c 100644 --- a/vendor/github.com/spotinst/spotinst-sdk-go/spotinst/version.go +++ b/vendor/github.com/spotinst/spotinst-sdk-go/spotinst/version.go @@ -1,7 +1,7 @@ package spotinst // SDKVersion is the current version of the SDK. -const SDKVersion = "1.171.0" +const SDKVersion = "1.372.0" // SDKName is the name of the SDK. const SDKName = "spotinst-sdk-go" diff --git a/vendor/modules.txt b/vendor/modules.txt index 5611be4208..373f1dba80 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1112,18 +1112,17 @@ github.com/spf13/viper/internal/encoding/json github.com/spf13/viper/internal/encoding/toml github.com/spf13/viper/internal/encoding/yaml github.com/spf13/viper/internal/features -# github.com/spotinst/spotinst-sdk-go v1.171.0 -## explicit; go 1.16 +# github.com/spotinst/spotinst-sdk-go v1.372.0 +## explicit; go 1.20 github.com/spotinst/spotinst-sdk-go/service/elastigroup github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/aws -github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure/v3 github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/gcp github.com/spotinst/spotinst-sdk-go/service/ocean github.com/spotinst/spotinst-sdk-go/service/ocean/providers/aws -github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure github.com/spotinst/spotinst-sdk-go/service/ocean/providers/azure_np github.com/spotinst/spotinst-sdk-go/service/ocean/providers/gcp +github.com/spotinst/spotinst-sdk-go/service/ocean/right_sizing github.com/spotinst/spotinst-sdk-go/service/ocean/spark github.com/spotinst/spotinst-sdk-go/spotinst github.com/spotinst/spotinst-sdk-go/spotinst/client From e9f0fc0aadaa40dcee92179db32be720aca7049b Mon Sep 17 00:00:00 2001 From: yehielnetapp Date: Mon, 4 Nov 2024 10:18:58 +0200 Subject: [PATCH 4/4] actual change to add feature aggressiveScaleDown --- pkg/model/awsmodel/spotinst.go | 9 +++++++ upup/pkg/fi/cloudup/spotinsttasks/ocean.go | 31 +++++++++++++++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/pkg/model/awsmodel/spotinst.go b/pkg/model/awsmodel/spotinst.go index ccbfa9d975..bb3344cc19 100644 --- a/pkg/model/awsmodel/spotinst.go +++ b/pkg/model/awsmodel/spotinst.go @@ -143,6 +143,10 @@ const ( // SpotClusterLabelResourceTagSpecificationVolumes // Specify if Volume resources will be tagged with Virtual Node Group tags or Ocean tags. SpotClusterLabelResourceTagSpecificationVolumes = "spotinst.io/resource-tag-specification-volumes" + + // SpotClusterLabelAutoScalerAggressiveScaleDown + // configure the aggressive scale down feature, the default is false. cluster.autoScaler.down.aggressiveScaleDown.isEnabled + SpotClusterLabelAutoScalerAggressiveScaleDown = "spotinst.io/autoscaler-aggressive-scale-down" ) // SpotInstanceGroupModelBuilder configures SpotInstanceGroup objects @@ -406,6 +410,11 @@ func (b *SpotInstanceGroupModelBuilder) buildOcean(c *fi.CloudupModelBuilderCont if err != nil { return err } + case SpotClusterLabelAutoScalerAggressiveScaleDown: + ocean.AutoScalerAggressiveScaleDown, err = parseBool(v) + if err != nil { + return err + } } } diff --git a/upup/pkg/fi/cloudup/spotinsttasks/ocean.go b/upup/pkg/fi/cloudup/spotinsttasks/ocean.go index e66902a0ec..e8a7b89fed 100644 --- a/upup/pkg/fi/cloudup/spotinsttasks/ocean.go +++ b/upup/pkg/fi/cloudup/spotinsttasks/ocean.go @@ -67,6 +67,7 @@ type Ocean struct { SpreadNodesBy *string AvailabilityVsCost *string ResourceTagSpecificationVolumes *bool + AutoScalerAggressiveScaleDown *bool } var ( @@ -324,9 +325,14 @@ func (o *Ocean) Find(c *fi.CloudupContext) (*Ocean, error) { // Scale down. if down := ocean.AutoScaler.Down; down != nil { - actual.AutoScalerOpts.Down = &AutoScalerDownOpts{ - MaxPercentage: down.MaxScaleDownPercentage, - EvaluationPeriods: down.EvaluationPeriods, + if down.MaxScaleDownPercentage != nil || down.EvaluationPeriods != nil { + actual.AutoScalerOpts.Down = &AutoScalerDownOpts{ + MaxPercentage: down.MaxScaleDownPercentage, + EvaluationPeriods: down.EvaluationPeriods, + } + } + if down.AggressiveScaleDown != nil { + actual.AutoScalerAggressiveScaleDown = down.AggressiveScaleDown.IsEnabled } } @@ -585,6 +591,16 @@ func (_ *Ocean) create(cloud awsup.AWSCloud, a, e, changes *Ocean) error { MaxMemoryGiB: limits.MaxMemory, } } + // create AutoScalerAggressiveScaleDown + { + if e.AutoScalerAggressiveScaleDown != nil { + aggressiveScaleDown := new(aws.AggressiveScaleDown) + if down := autoScaler.Down; down == nil { + autoScaler.Down = new(aws.AutoScalerDown) + } + autoScaler.Down.SetAggressiveScaleDown(aggressiveScaleDown.SetIsEnabled(fi.PtrTo(*e.AutoScalerAggressiveScaleDown))) + } + } ocean.SetAutoScaler(autoScaler) } @@ -1084,6 +1100,15 @@ func (_ *Ocean) update(cloud awsup.AWSCloud, a, e, changes *Ocean) error { } else if a.AutoScalerOpts.ResourceLimits != nil { autoScaler.SetResourceLimits(nil) } + // AutoScaler aggressive scale down + if changes.AutoScalerAggressiveScaleDown != nil { + aggressiveScaleDown := new(aws.AggressiveScaleDown) + if down := autoScaler.Down; down == nil { + autoScaler.Down = new(aws.AutoScalerDown) + } + autoScaler.Down.SetAggressiveScaleDown(aggressiveScaleDown.SetIsEnabled(fi.PtrTo(*changes.AutoScalerAggressiveScaleDown))) + changes.AutoScalerAggressiveScaleDown = nil + } ocean.SetAutoScaler(autoScaler) changed = true