Skip to content
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
13 changes: 7 additions & 6 deletions hcn/hcn.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package hcn

import (
"encoding/json"
"fmt"
"syscall"

Expand Down Expand Up @@ -93,12 +94,12 @@ type HostComputeQuery struct {
}

type ExtraParams struct {
Resources interface{} `json:",omitempty"`
SharedContainers interface{} `json:",omitempty"`
LayeredOn string `json:",omitempty"`
SwitchGuid string `json:",omitempty"`
UtilityVM string `json:",omitempty"`
VirtualMachine string `json:",omitempty"`
Resources json.RawMessage `json:",omitempty"`
SharedContainers json.RawMessage `json:",omitempty"`
Comment on lines +97 to +98
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious: why did you change these?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easier to unmarshal into something as it's just bytes instead of an interface

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var exi ExtraInfo
if err := json.Unmarshal(ep.Health.Extra.Resources, &exi); err != nil {
	return errors.Wrapf(err, "failed to unmarshal resource data from endpoint %q", endpointID)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, good point

LayeredOn string `json:",omitempty"`
SwitchGuid string `json:",omitempty"`
UtilityVM string `json:",omitempty"`
VirtualMachine string `json:",omitempty"`
}

type Health struct {
Expand Down
8 changes: 8 additions & 0 deletions hcn/hcnendpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type HostComputeEndpoint struct {
Routes []Route `json:",omitempty"`
MacAddress string `json:",omitempty"`
Flags EndpointFlags `json:",omitempty"`
Health Health `json:",omitempty"`
SchemaVersion SchemaVersion `json:",omitempty"`
}

Expand All @@ -58,6 +59,13 @@ type ModifyEndpointSettingRequest struct {
Settings json.RawMessage `json:",omitempty"`
}

// VmEndpointRequest creates a switch port with identifier `PortId`.
type VmEndpointRequest struct {
PortId guid.GUID `json:",omitempty"`
VirtualNicName string `json:",omitempty"`
VirtualMachineId guid.GUID `json:",omitempty"`
}

type PolicyEndpointRequest struct {
Policies []EndpointPolicy `json:",omitempty"`
}
Expand Down