From 94b7528d946cb1cae53279d5a462a09eb35c87d2 Mon Sep 17 00:00:00 2001 From: Phil Browne Date: Fri, 21 Jun 2024 14:19:25 +0000 Subject: [PATCH 1/2] fix: support updating cost_centre in mve --- mve.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mve.go b/mve.go index 84347f9..516acae 100644 --- a/mve.go +++ b/mve.go @@ -63,6 +63,7 @@ type ModifyMVERequest struct { MVEID string Name string MarketplaceVisibility *bool + CostCentre string WaitForUpdate bool // Wait until the MCVEupdates before returning WaitForTime time.Duration // How long to wait for the MVE to update if WaitForUpdate is true (default is 5 minutes) @@ -260,10 +261,15 @@ func (svc *MVEServiceOp) ModifyMVE(ctx context.Context, req *ModifyMVERequest) ( modifyProductReq := &ModifyProductRequest{ ProductID: req.MVEID, ProductType: PRODUCT_MVE, - Name: req.Name, - CostCentre: "", MarketplaceVisibility: PtrTo(false), } + if req.Name != "" { + modifyProductReq.Name = req.Name + } + if req.CostCentre != "" { + modifyProductReq.CostCentre = req.CostCentre + } + _, err := svc.Client.ProductService.ModifyProduct(ctx, modifyProductReq) if err != nil { return nil, err From 5df40a56ba49c6e593173df3717c35cceea84049 Mon Sep 17 00:00:00 2001 From: Phil Browne Date: Fri, 21 Jun 2024 14:23:29 +0000 Subject: [PATCH 2/2] fix: support cost centre in mve order --- mve.go | 2 ++ mve_types.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/mve.go b/mve.go index 516acae..171b98b 100644 --- a/mve.go +++ b/mve.go @@ -48,6 +48,7 @@ type BuyMVERequest struct { Vnics []MVENetworkInterface DiversityZone string PromoCode string + CostCentre string WaitForProvision bool // Wait until the MVE provisions before returning WaitForTime time.Duration // How long to wait for the MVE to provision if WaitForProvision is true (default is 5 minutes) @@ -95,6 +96,7 @@ func (svc *MVEServiceOp) BuyMVE(ctx context.Context, req *BuyMVERequest) (*BuyMV Name: req.Name, Term: req.Term, PromoCode: req.PromoCode, + CostCentre: req.CostCentre, ProductType: strings.ToUpper(PRODUCT_MVE), DiversityZone: req.DiversityZone, } diff --git a/mve_types.go b/mve_types.go index b04124a..1481b16 100644 --- a/mve_types.go +++ b/mve_types.go @@ -8,6 +8,7 @@ type MVEOrderConfig struct { ProductType string `json:"productType"` DiversityZone string `json:"diversityZone"` PromoCode string `json:"promoCode,omitempty"` + CostCentre string `json:"costCentre,omitempty"` NetworkInterfaces []MVENetworkInterface `json:"vnics"` VendorConfig VendorConfig `json:"vendorConfig"` } @@ -152,6 +153,7 @@ type MVE struct { ContractEndDate *Time `json:"contractEndDate"` ContractTermMonths int `json:"contractTermMonths"` AttributeTags map[string]string `json:"attributeTags"` + CostCentre string `json:"costCentre"` Virtual bool `json:"virtual"` BuyoutPort bool `json:"buyoutPort"` Locked bool `json:"locked"`