Skip to content

Commit

Permalink
Amend Defined Interface updates (#566)
Browse files Browse the repository at this point in the history
Signed-off-by: abarreiro <abarreiro@vmware.com>
  • Loading branch information
adambarreiro authored Apr 18, 2023
1 parent 2a4976d commit e9d15fd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .changes/v2.20.0/527-features.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
* Added support for Runtime Defined Entity Interfaces with client methods `VCDClient.CreateDefinedInterface`, `VCDClient.GetAllDefinedInterfaces`,
`VCDClient.GetDefinedInterface`, `VCDClient.GetDefinedInterfaceById` and methods to manipulate them `DefinedInterface.Update`,
`DefinedInterface.Delete` [GH-527]
`DefinedInterface.Delete` [GH-527, GH-566]
2 changes: 1 addition & 1 deletion .changes/v2.20.0/545-features.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
* Added support for Runtime Defined Entity Types with client methods `VCDClient.CreateRdeType`, `VCDClient.GetAllRdeTypes`,
`VCDClient.GetRdeType`, `VCDClient.GetRdeTypeById` and methods to manipulate them `DefinedEntityType.Update`,
`DefinedEntityType.Delete` [GH-545]
`DefinedEntityType.Delete` [GH-545, GH-566]
3 changes: 3 additions & 0 deletions govcd/defined_entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ func (rdeType *DefinedEntityType) Update(rdeTypeToUpdate types.DefinedEntityType
if rdeTypeToUpdate.Schema == nil || len(rdeTypeToUpdate.Schema) == 0 {
rdeTypeToUpdate.Schema = rdeType.DefinedEntityType.Schema
}
rdeTypeToUpdate.Version = rdeType.DefinedEntityType.Version
rdeTypeToUpdate.Nss = rdeType.DefinedEntityType.Nss
rdeTypeToUpdate.Vendor = rdeType.DefinedEntityType.Vendor

endpoint := types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointRdeEntityTypes
apiVersion, err := client.getOpenApiHighestElevatedVersion(endpoint)
Expand Down
5 changes: 5 additions & 0 deletions govcd/defined_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ func (di *DefinedInterface) Update(definedInterface types.DefinedInterface) erro
return fmt.Errorf("ID of the receiver Defined Interface and the input ID don't match")
}

// We override these as they need to be always sent on updates
definedInterface.Version = di.DefinedInterface.Version
definedInterface.Nss = di.DefinedInterface.Nss
definedInterface.Vendor = di.DefinedInterface.Vendor

endpoint := types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointRdeInterfaces
apiVersion, err := client.getOpenApiHighestElevatedVersion(endpoint)
if err != nil {
Expand Down

0 comments on commit e9d15fd

Please sign in to comment.