Skip to content

Commit

Permalink
Self review
Browse files Browse the repository at this point in the history
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
  • Loading branch information
Didainius committed May 20, 2024
1 parent 457253e commit 8d8810c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions .changes/v2.25.0/670-features.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
* Added types `SolutionAddOn`, `SolutionAddOnConfig` and `types.SolutionAddOn` for Solution Add-on
Landing configuration [GH-670]
* Added `VDCClient` methods `CreateSolutionAddOn`, `GetAllSolutionAddons`, `GetSolutionAddonById`,
* Added `VCDClient` methods `CreateSolutionAddOn`, `GetAllSolutionAddons`, `GetSolutionAddonById`,
`GetSolutionAddonByName` for handling Solution Add-Ons [GH-670]
* Added `SolutionAddOn` methods `Update`, `RdeId`, `Delete` to help handling of Solution Landing
Zones [GH-670]
* Added `VDCClient` method `TrustAddOnImageCertificate` to trust certificate if it is not yet
* Added `VCDClient` method `TrustAddOnImageCertificate` to trust certificate if it is not yet
trusted [GH-670]
31 changes: 16 additions & 15 deletions govcd/landing_zone_add_on.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ var slzAddOnRdeType = [3]string{"vmware", "solutions_add_on", "1.0.0"}
// SolutionAddOn is the main structure to handle Solution Add-Ons within Solution Landing Zone. It
// packs parent RDE and Solution Add-On entity itself
type SolutionAddOn struct {
SolutionEntity *types.SolutionAddOn
DefinedEntity *DefinedEntity
vcdClient *VCDClient
SolutionAddOnEntity *types.SolutionAddOn
DefinedEntity *DefinedEntity
vcdClient *VCDClient
}

// SolutionAddOnConfig defines configuration for Solution Add-On creation which is used for
Expand Down Expand Up @@ -101,6 +101,7 @@ func createSolutionAddOnValidator(cfg SolutionAddOnConfig) error {
// * Create the 'Entity' payload for creating RDE based on the given image
// * Get Solution Add-On RDE Name from the manifest within 'isoFilePath'
// * If 'autoTrustCertificate' is set to true - the code will check if VCD trusts the certificate
// and trust it if it wasn't already trusted
// * Lookup RDE type 'vmware:solutions_add_on:1.0.0'
// * Create an RDE entity with payload from the 'isoFilePath' contents
func (vcdClient *VCDClient) CreateSolutionAddOn(cfg SolutionAddOnConfig) (*SolutionAddOn, error) {
Expand Down Expand Up @@ -169,9 +170,9 @@ func (vcdClient *VCDClient) CreateSolutionAddOn(cfg SolutionAddOnConfig) (*Solut
}

returnType := SolutionAddOn{
SolutionEntity: result,
vcdClient: vcdClient,
DefinedEntity: createdRdeEntity,
SolutionAddOnEntity: result,
vcdClient: vcdClient,
DefinedEntity: createdRdeEntity,
}

return &returnType, nil
Expand All @@ -192,9 +193,9 @@ func (vcdClient *VCDClient) GetAllSolutionAddons(queryParameters url.Values) ([]
}

results[index] = &SolutionAddOn{
vcdClient: vcdClient,
DefinedEntity: rde,
SolutionEntity: addon,
vcdClient: vcdClient,
DefinedEntity: rde,
SolutionAddOnEntity: addon,
}
}

Expand All @@ -217,9 +218,9 @@ func (vcdClient *VCDClient) GetSolutionAddonById(id string) (*SolutionAddOn, err
}

packages := &SolutionAddOn{
SolutionEntity: result,
vcdClient: vcdClient,
DefinedEntity: rde,
SolutionAddOnEntity: result,
vcdClient: vcdClient,
DefinedEntity: rde,
}

return packages, nil
Expand Down Expand Up @@ -260,9 +261,9 @@ func (s *SolutionAddOn) Update(saoCfg *types.SolutionAddOn) (*SolutionAddOn, err
}

packages := SolutionAddOn{
SolutionEntity: result,
vcdClient: s.vcdClient,
DefinedEntity: s.DefinedEntity,
SolutionAddOnEntity: result,
vcdClient: s.vcdClient,
DefinedEntity: s.DefinedEntity,
}

return &packages, nil
Expand Down
1 change: 1 addition & 0 deletions types/v56/slz.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type SolutionLandingZoneVdcChild struct {
Capabilities []string `json:"capabilities"`
}

// SolutionAddOn defines structure of Solution Add-On that is deployed in the Solution Landing Zone
type SolutionAddOn struct {
Eula string `json:"eula"`
Icon string `json:"icon"`
Expand Down

0 comments on commit 8d8810c

Please sign in to comment.