Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amend Defined Interface updates #566

Merged
merged 4 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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