2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-16 01:57:10 +00:00
restic/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/models.go
Alexander Neumann 946c8399e2 Update dependenciess
Exclude minio-go for now (pin to 3.x.y).
2017-12-03 21:22:33 +01:00

1676 lines
54 KiB
Go
Executable File

package servicemap
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"encoding/json"
"errors"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"net/http"
)
// Accuracy enumerates the values for accuracy.
type Accuracy string
const (
// Actual specifies the actual state for accuracy.
Actual Accuracy = "actual"
// Estimated specifies the estimated state for accuracy.
Estimated Accuracy = "estimated"
)
// Bitness enumerates the values for bitness.
type Bitness string
const (
// SixFourbit specifies the six fourbit state for bitness.
SixFourbit Bitness = "64bit"
// ThreeTwobit specifies the three twobit state for bitness.
ThreeTwobit Bitness = "32bit"
)
// ConnectionFailureState enumerates the values for connection failure state.
type ConnectionFailureState string
const (
// Failed specifies the failed state for connection failure state.
Failed ConnectionFailureState = "failed"
// Mixed specifies the mixed state for connection failure state.
Mixed ConnectionFailureState = "mixed"
// Ok specifies the ok state for connection failure state.
Ok ConnectionFailureState = "ok"
)
// HypervisorType enumerates the values for hypervisor type.
type HypervisorType string
const (
// Hyperv specifies the hyperv state for hypervisor type.
Hyperv HypervisorType = "hyperv"
// Unknown specifies the unknown state for hypervisor type.
Unknown HypervisorType = "unknown"
)
// Kind enumerates the values for kind.
type Kind string
const (
// KindRefmachine specifies the kind refmachine state for kind.
KindRefmachine Kind = "ref:machine"
// KindRefmachinewithhints specifies the kind refmachinewithhints state for kind.
KindRefmachinewithhints Kind = "ref:machinewithhints"
// KindRefport specifies the kind refport state for kind.
KindRefport Kind = "ref:port"
// KindRefprocess specifies the kind refprocess state for kind.
KindRefprocess Kind = "ref:process"
)
// KindCoreResource enumerates the values for kind core resource.
type KindCoreResource string
const (
// KindClientGroup specifies the kind client group state for kind core resource.
KindClientGroup KindCoreResource = "clientGroup"
// KindMachine specifies the kind machine state for kind core resource.
KindMachine KindCoreResource = "machine"
// KindMachineGroup specifies the kind machine group state for kind core resource.
KindMachineGroup KindCoreResource = "machineGroup"
// KindPort specifies the kind port state for kind core resource.
KindPort KindCoreResource = "port"
// KindProcess specifies the kind process state for kind core resource.
KindProcess KindCoreResource = "process"
)
// KindMapRequest enumerates the values for kind map request.
type KindMapRequest string
const (
// KindMapmachineGroupDependency specifies the kind mapmachine group dependency state for kind map request.
KindMapmachineGroupDependency KindMapRequest = "map:machine-group-dependency"
// KindMapsingleMachineDependency specifies the kind mapsingle machine dependency state for kind map request.
KindMapsingleMachineDependency KindMapRequest = "map:single-machine-dependency"
)
// KindRelationship enumerates the values for kind relationship.
type KindRelationship string
const (
// KindRelacceptor specifies the kind relacceptor state for kind relationship.
KindRelacceptor KindRelationship = "rel:acceptor"
// KindRelconnection specifies the kind relconnection state for kind relationship.
KindRelconnection KindRelationship = "rel:connection"
)
// MachineRebootStatus enumerates the values for machine reboot status.
type MachineRebootStatus string
const (
// MachineRebootStatusNotRebooted specifies the machine reboot status not rebooted state for machine reboot status.
MachineRebootStatusNotRebooted MachineRebootStatus = "notRebooted"
// MachineRebootStatusRebooted specifies the machine reboot status rebooted state for machine reboot status.
MachineRebootStatusRebooted MachineRebootStatus = "rebooted"
// MachineRebootStatusUnknown specifies the machine reboot status unknown state for machine reboot status.
MachineRebootStatusUnknown MachineRebootStatus = "unknown"
)
// MonitoringState enumerates the values for monitoring state.
type MonitoringState string
const (
// Discovered specifies the discovered state for monitoring state.
Discovered MonitoringState = "discovered"
// Monitored specifies the monitored state for monitoring state.
Monitored MonitoringState = "monitored"
)
// OperatingSystemFamily enumerates the values for operating system family.
type OperatingSystemFamily string
const (
// OperatingSystemFamilyAix specifies the operating system family aix state for operating system family.
OperatingSystemFamilyAix OperatingSystemFamily = "aix"
// OperatingSystemFamilyLinux specifies the operating system family linux state for operating system family.
OperatingSystemFamilyLinux OperatingSystemFamily = "linux"
// OperatingSystemFamilySolaris specifies the operating system family solaris state for operating system family.
OperatingSystemFamilySolaris OperatingSystemFamily = "solaris"
// OperatingSystemFamilyUnknown specifies the operating system family unknown state for operating system family.
OperatingSystemFamilyUnknown OperatingSystemFamily = "unknown"
// OperatingSystemFamilyWindows specifies the operating system family windows state for operating system family.
OperatingSystemFamilyWindows OperatingSystemFamily = "windows"
)
// ProcessRole enumerates the values for process role.
type ProcessRole string
const (
// AppServer specifies the app server state for process role.
AppServer ProcessRole = "appServer"
// DatabaseServer specifies the database server state for process role.
DatabaseServer ProcessRole = "databaseServer"
// LdapServer specifies the ldap server state for process role.
LdapServer ProcessRole = "ldapServer"
// SmbServer specifies the smb server state for process role.
SmbServer ProcessRole = "smbServer"
// WebServer specifies the web server state for process role.
WebServer ProcessRole = "webServer"
)
// VirtualizationState enumerates the values for virtualization state.
type VirtualizationState string
const (
// VirtualizationStateHypervisor specifies the virtualization state hypervisor state for virtualization state.
VirtualizationStateHypervisor VirtualizationState = "hypervisor"
// VirtualizationStatePhysical specifies the virtualization state physical state for virtualization state.
VirtualizationStatePhysical VirtualizationState = "physical"
// VirtualizationStateUnknown specifies the virtualization state unknown state for virtualization state.
VirtualizationStateUnknown VirtualizationState = "unknown"
// VirtualizationStateVirtual specifies the virtualization state virtual state for virtualization state.
VirtualizationStateVirtual VirtualizationState = "virtual"
)
// VirtualMachineType enumerates the values for virtual machine type.
type VirtualMachineType string
const (
// VirtualMachineTypeHyperv specifies the virtual machine type hyperv state for virtual machine type.
VirtualMachineTypeHyperv VirtualMachineType = "hyperv"
// VirtualMachineTypeLdom specifies the virtual machine type ldom state for virtual machine type.
VirtualMachineTypeLdom VirtualMachineType = "ldom"
// VirtualMachineTypeLpar specifies the virtual machine type lpar state for virtual machine type.
VirtualMachineTypeLpar VirtualMachineType = "lpar"
// VirtualMachineTypeUnknown specifies the virtual machine type unknown state for virtual machine type.
VirtualMachineTypeUnknown VirtualMachineType = "unknown"
// VirtualMachineTypeVirtualPc specifies the virtual machine type virtual pc state for virtual machine type.
VirtualMachineTypeVirtualPc VirtualMachineType = "virtualPc"
// VirtualMachineTypeVmware specifies the virtual machine type vmware state for virtual machine type.
VirtualMachineTypeVmware VirtualMachineType = "vmware"
// VirtualMachineTypeXen specifies the virtual machine type xen state for virtual machine type.
VirtualMachineTypeXen VirtualMachineType = "xen"
)
// Acceptor is a process accepting on a port.
type Acceptor struct {
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Kind KindRelationship `json:"kind,omitempty"`
*AcceptorProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for Acceptor.
func (a Acceptor) MarshalJSON() ([]byte, error) {
a.Kind = KindRelacceptor
type Alias Acceptor
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(a),
})
}
// AsConnection is the Relationship implementation for Acceptor.
func (a Acceptor) AsConnection() (*Connection, bool) {
return nil, false
}
// AsAcceptor is the Relationship implementation for Acceptor.
func (a Acceptor) AsAcceptor() (*Acceptor, bool) {
return &a, true
}
// AcceptorProperties is properties for an acceptor relationship.
type AcceptorProperties struct {
Source *PortReference `json:"source,omitempty"`
Destination *ProcessReference `json:"destination,omitempty"`
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
}
// AgentConfiguration is describes the configuration of the Dependency Agent installed on a machine.
type AgentConfiguration struct {
AgentID *string `json:"agentId,omitempty"`
DependencyAgentID *string `json:"dependencyAgentId,omitempty"`
DependencyAgentVersion *string `json:"dependencyAgentVersion,omitempty"`
DependencyAgentRevision *string `json:"dependencyAgentRevision,omitempty"`
RebootStatus MachineRebootStatus `json:"rebootStatus,omitempty"`
ClockGranularity *int32 `json:"clockGranularity,omitempty"`
}
// ClientGroup is represents a collection of clients of a resource. A client group can represent the clients of a port,
// process, or a machine.
type ClientGroup struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Etag *string `json:"etag,omitempty"`
Kind KindCoreResource `json:"kind,omitempty"`
*ClientGroupProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for ClientGroup.
func (cg ClientGroup) MarshalJSON() ([]byte, error) {
cg.Kind = KindClientGroup
type Alias ClientGroup
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(cg),
})
}
// AsMachine is the CoreResource implementation for ClientGroup.
func (cg ClientGroup) AsMachine() (*Machine, bool) {
return nil, false
}
// AsProcess is the CoreResource implementation for ClientGroup.
func (cg ClientGroup) AsProcess() (*Process, bool) {
return nil, false
}
// AsPort is the CoreResource implementation for ClientGroup.
func (cg ClientGroup) AsPort() (*Port, bool) {
return nil, false
}
// AsClientGroup is the CoreResource implementation for ClientGroup.
func (cg ClientGroup) AsClientGroup() (*ClientGroup, bool) {
return &cg, true
}
// AsMachineGroup is the CoreResource implementation for ClientGroup.
func (cg ClientGroup) AsMachineGroup() (*MachineGroup, bool) {
return nil, false
}
// ClientGroupMember is represents a member of a client group
type ClientGroupMember struct {
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
*ClientGroupMemberProperties `json:"properties,omitempty"`
}
// ClientGroupMemberProperties is resource properties.
type ClientGroupMemberProperties struct {
IPAddress *string `json:"ipAddress,omitempty"`
Port *PortReference `json:"port,omitempty"`
Processes *[]ProcessReference `json:"processes,omitempty"`
}
// ClientGroupMembersCollection is collection of ClientGroupMember resources.
type ClientGroupMembersCollection struct {
autorest.Response `json:"-"`
Value *[]ClientGroupMember `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ClientGroupMembersCollectionPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ClientGroupMembersCollection) ClientGroupMembersCollectionPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// ClientGroupMembersCount is specifies the number of members in a client group.
type ClientGroupMembersCount struct {
autorest.Response `json:"-"`
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
GroupID *string `json:"groupId,omitempty"`
Count *int32 `json:"count,omitempty"`
Accuracy Accuracy `json:"accuracy,omitempty"`
}
// ClientGroupProperties is resource properties.
type ClientGroupProperties struct {
ClientsOf ResourceReference `json:"clientsOf,omitempty"`
}
// UnmarshalJSON is the custom unmarshaler for ClientGroupProperties struct.
func (cg *ClientGroupProperties) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
var v *json.RawMessage
v = m["clientsOf"]
if v != nil {
clientsOf, err := unmarshalResourceReference(*m["clientsOf"])
if err != nil {
return err
}
cg.ClientsOf = clientsOf
}
return nil
}
// Connection is a network connection.
type Connection struct {
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Kind KindRelationship `json:"kind,omitempty"`
*ConnectionProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for Connection.
func (c Connection) MarshalJSON() ([]byte, error) {
c.Kind = KindRelconnection
type Alias Connection
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(c),
})
}
// AsConnection is the Relationship implementation for Connection.
func (c Connection) AsConnection() (*Connection, bool) {
return &c, true
}
// AsAcceptor is the Relationship implementation for Connection.
func (c Connection) AsAcceptor() (*Acceptor, bool) {
return nil, false
}
// ConnectionCollection is collection of Connection resources.
type ConnectionCollection struct {
autorest.Response `json:"-"`
Value *[]Connection `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ConnectionCollectionPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ConnectionCollection) ConnectionCollectionPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// ConnectionProperties is properties for a connection resource.
type ConnectionProperties struct {
Source ResourceReference `json:"source,omitempty"`
Destination ResourceReference `json:"destination,omitempty"`
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
ServerPort *PortReference `json:"serverPort,omitempty"`
FailureState ConnectionFailureState `json:"failureState,omitempty"`
}
// UnmarshalJSON is the custom unmarshaler for ConnectionProperties struct.
func (cp *ConnectionProperties) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
var v *json.RawMessage
v = m["serverPort"]
if v != nil {
var serverPort PortReference
err = json.Unmarshal(*m["serverPort"], &serverPort)
if err != nil {
return err
}
cp.ServerPort = &serverPort
}
v = m["failureState"]
if v != nil {
var failureState ConnectionFailureState
err = json.Unmarshal(*m["failureState"], &failureState)
if err != nil {
return err
}
cp.FailureState = failureState
}
v = m["source"]
if v != nil {
source, err := unmarshalResourceReference(*m["source"])
if err != nil {
return err
}
cp.Source = source
}
v = m["destination"]
if v != nil {
destination, err := unmarshalResourceReference(*m["destination"])
if err != nil {
return err
}
cp.Destination = destination
}
v = m["startTime"]
if v != nil {
var startTime date.Time
err = json.Unmarshal(*m["startTime"], &startTime)
if err != nil {
return err
}
cp.StartTime = &startTime
}
v = m["endTime"]
if v != nil {
var endTime date.Time
err = json.Unmarshal(*m["endTime"], &endTime)
if err != nil {
return err
}
cp.EndTime = &endTime
}
return nil
}
// CoreResource is marker resource for the core Service Map resources
type CoreResource interface {
AsMachine() (*Machine, bool)
AsProcess() (*Process, bool)
AsPort() (*Port, bool)
AsClientGroup() (*ClientGroup, bool)
AsMachineGroup() (*MachineGroup, bool)
}
func unmarshalCoreResource(body []byte) (CoreResource, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["kind"] {
case string(KindMachine):
var m Machine
err := json.Unmarshal(body, &m)
return m, err
case string(KindProcess):
var p Process
err := json.Unmarshal(body, &p)
return p, err
case string(KindPort):
var p Port
err := json.Unmarshal(body, &p)
return p, err
case string(KindClientGroup):
var cg ClientGroup
err := json.Unmarshal(body, &cg)
return cg, err
case string(KindMachineGroup):
var mg MachineGroup
err := json.Unmarshal(body, &mg)
return mg, err
default:
return nil, errors.New("Unsupported type")
}
}
func unmarshalCoreResourceArray(body []byte) ([]CoreResource, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
crArray := make([]CoreResource, len(rawMessages))
for index, rawMessage := range rawMessages {
cr, err := unmarshalCoreResource(*rawMessage)
if err != nil {
return nil, err
}
crArray[index] = cr
}
return crArray, nil
}
// Error is error details.
type Error struct {
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
}
// ErrorResponse is an error response from the API.
type ErrorResponse struct {
Error *Error `json:"error,omitempty"`
}
// HypervisorConfiguration is describes the hypervisor configuration of a machine.
type HypervisorConfiguration struct {
HypervisorType HypervisorType `json:"hypervisorType,omitempty"`
NativeHostMachineID *string `json:"nativeHostMachineId,omitempty"`
}
// Ipv4NetworkInterface is describes an IPv4 network interface.
type Ipv4NetworkInterface struct {
IPAddress *string `json:"ipAddress,omitempty"`
SubnetMask *string `json:"subnetMask,omitempty"`
}
// Ipv6NetworkInterface is describes an IPv6 network interface.
type Ipv6NetworkInterface struct {
IPAddress *string `json:"ipAddress,omitempty"`
}
// Liveness is specifies the contents of a check liveness response.
type Liveness struct {
autorest.Response `json:"-"`
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
Live *bool `json:"live,omitempty"`
}
// Machine is a machine resource represents a discovered computer system. It can be *monitored*, i.e., a Dependency
// Agent is running on it, or *discovered*, i.e., its existence was inferred by observing the data stream from
// monitored machines. As machines change, prior versions of the machine resource are preserved and available for
// access. A machine is live during an interval of time, if either its Dependency Agent has reported data during
// (parts) of that interval, or a Dependency agent running on other machines has reported activity associated with the
// machine.
type Machine struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Etag *string `json:"etag,omitempty"`
Kind KindCoreResource `json:"kind,omitempty"`
*MachineProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for Machine.
func (m Machine) MarshalJSON() ([]byte, error) {
m.Kind = KindMachine
type Alias Machine
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(m),
})
}
// AsMachine is the CoreResource implementation for Machine.
func (m Machine) AsMachine() (*Machine, bool) {
return &m, true
}
// AsProcess is the CoreResource implementation for Machine.
func (m Machine) AsProcess() (*Process, bool) {
return nil, false
}
// AsPort is the CoreResource implementation for Machine.
func (m Machine) AsPort() (*Port, bool) {
return nil, false
}
// AsClientGroup is the CoreResource implementation for Machine.
func (m Machine) AsClientGroup() (*ClientGroup, bool) {
return nil, false
}
// AsMachineGroup is the CoreResource implementation for Machine.
func (m Machine) AsMachineGroup() (*MachineGroup, bool) {
return nil, false
}
// MachineCollection is collection of Machine resources.
type MachineCollection struct {
autorest.Response `json:"-"`
Value *[]Machine `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// MachineCollectionPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client MachineCollection) MachineCollectionPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// MachineCountsByOperatingSystem is machines by operating system.
type MachineCountsByOperatingSystem struct {
Windows *int32 `json:"windows,omitempty"`
Linux *int32 `json:"linux,omitempty"`
}
// MachineGroup is a user-defined logical grouping of machines.
type MachineGroup struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Etag *string `json:"etag,omitempty"`
Kind KindCoreResource `json:"kind,omitempty"`
*MachineGroupProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for MachineGroup.
func (mg MachineGroup) MarshalJSON() ([]byte, error) {
mg.Kind = KindMachineGroup
type Alias MachineGroup
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(mg),
})
}
// AsMachine is the CoreResource implementation for MachineGroup.
func (mg MachineGroup) AsMachine() (*Machine, bool) {
return nil, false
}
// AsProcess is the CoreResource implementation for MachineGroup.
func (mg MachineGroup) AsProcess() (*Process, bool) {
return nil, false
}
// AsPort is the CoreResource implementation for MachineGroup.
func (mg MachineGroup) AsPort() (*Port, bool) {
return nil, false
}
// AsClientGroup is the CoreResource implementation for MachineGroup.
func (mg MachineGroup) AsClientGroup() (*ClientGroup, bool) {
return nil, false
}
// AsMachineGroup is the CoreResource implementation for MachineGroup.
func (mg MachineGroup) AsMachineGroup() (*MachineGroup, bool) {
return &mg, true
}
// MachineGroupCollection is collection of Machine Group resources.
type MachineGroupCollection struct {
autorest.Response `json:"-"`
Value *[]MachineGroup `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// MachineGroupCollectionPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client MachineGroupCollection) MachineGroupCollectionPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// MachineGroupMapRequest is specifies the computation of a machine group dependency map. A machine group dependency
// map includes all direct dependencies of a group of machines.
type MachineGroupMapRequest struct {
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
Kind KindMapRequest `json:"kind,omitempty"`
MachineGroupID *string `json:"machineGroupId,omitempty"`
FilterProcesses *bool `json:"filterProcesses,omitempty"`
}
// MarshalJSON is the custom marshaler for MachineGroupMapRequest.
func (mgmr MachineGroupMapRequest) MarshalJSON() ([]byte, error) {
mgmr.Kind = KindMapmachineGroupDependency
type Alias MachineGroupMapRequest
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(mgmr),
})
}
// AsSingleMachineDependencyMapRequest is the MapRequest implementation for MachineGroupMapRequest.
func (mgmr MachineGroupMapRequest) AsSingleMachineDependencyMapRequest() (*SingleMachineDependencyMapRequest, bool) {
return nil, false
}
// AsMachineGroupMapRequest is the MapRequest implementation for MachineGroupMapRequest.
func (mgmr MachineGroupMapRequest) AsMachineGroupMapRequest() (*MachineGroupMapRequest, bool) {
return &mgmr, true
}
// MachineGroupProperties is resource properties.
type MachineGroupProperties struct {
DisplayName *string `json:"displayName,omitempty"`
Machines *[]MachineReferenceWithHints `json:"machines,omitempty"`
}
// MachineProperties is resource properties.
type MachineProperties struct {
Timestamp *date.Time `json:"timestamp,omitempty"`
MonitoringState MonitoringState `json:"monitoringState,omitempty"`
VirtualizationState VirtualizationState `json:"virtualizationState,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
ComputerName *string `json:"computerName,omitempty"`
FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"`
BootTime *date.Time `json:"bootTime,omitempty"`
Timezone *Timezone `json:"timezone,omitempty"`
Agent *AgentConfiguration `json:"agent,omitempty"`
Resources *MachineResourcesConfiguration `json:"resources,omitempty"`
Networking *NetworkConfiguration `json:"networking,omitempty"`
OperatingSystem *OperatingSystemConfiguration `json:"operatingSystem,omitempty"`
VirtualMachine *VirtualMachineConfiguration `json:"virtualMachine,omitempty"`
Hypervisor *HypervisorConfiguration `json:"hypervisor,omitempty"`
}
// MachineReference is reference to a machine.
type MachineReference struct {
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Kind Kind `json:"kind,omitempty"`
}
// MarshalJSON is the custom marshaler for MachineReference.
func (mr MachineReference) MarshalJSON() ([]byte, error) {
mr.Kind = KindRefmachine
type Alias MachineReference
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(mr),
})
}
// AsMachineReference is the ResourceReference implementation for MachineReference.
func (mr MachineReference) AsMachineReference() (*MachineReference, bool) {
return &mr, true
}
// AsProcessReference is the ResourceReference implementation for MachineReference.
func (mr MachineReference) AsProcessReference() (*ProcessReference, bool) {
return nil, false
}
// AsPortReference is the ResourceReference implementation for MachineReference.
func (mr MachineReference) AsPortReference() (*PortReference, bool) {
return nil, false
}
// AsMachineReferenceWithHints is the ResourceReference implementation for MachineReference.
func (mr MachineReference) AsMachineReferenceWithHints() (*MachineReferenceWithHints, bool) {
return nil, false
}
// MachineReferenceWithHints is a machine reference with a hint of the machine's name and operating system.
type MachineReferenceWithHints struct {
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Kind Kind `json:"kind,omitempty"`
*MachineReferenceWithHintsProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for MachineReferenceWithHints.
func (mrwh MachineReferenceWithHints) MarshalJSON() ([]byte, error) {
mrwh.Kind = KindRefmachinewithhints
type Alias MachineReferenceWithHints
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(mrwh),
})
}
// AsMachineReference is the ResourceReference implementation for MachineReferenceWithHints.
func (mrwh MachineReferenceWithHints) AsMachineReference() (*MachineReference, bool) {
return nil, false
}
// AsProcessReference is the ResourceReference implementation for MachineReferenceWithHints.
func (mrwh MachineReferenceWithHints) AsProcessReference() (*ProcessReference, bool) {
return nil, false
}
// AsPortReference is the ResourceReference implementation for MachineReferenceWithHints.
func (mrwh MachineReferenceWithHints) AsPortReference() (*PortReference, bool) {
return nil, false
}
// AsMachineReferenceWithHints is the ResourceReference implementation for MachineReferenceWithHints.
func (mrwh MachineReferenceWithHints) AsMachineReferenceWithHints() (*MachineReferenceWithHints, bool) {
return &mrwh, true
}
// MachineReferenceWithHintsProperties is machine reference with name and os hints.
type MachineReferenceWithHintsProperties struct {
DisplayNameHint *string `json:"displayNameHint,omitempty"`
OsFamilyHint OperatingSystemFamily `json:"osFamilyHint,omitempty"`
}
// MachineResourcesConfiguration is describes the resources of a machine.
type MachineResourcesConfiguration struct {
PhysicalMemory *int32 `json:"physicalMemory,omitempty"`
Cpus *int32 `json:"cpus,omitempty"`
CPUSpeed *int32 `json:"cpuSpeed,omitempty"`
CPUSpeedAccuracy Accuracy `json:"cpuSpeedAccuracy,omitempty"`
}
// MachinesSummary is a summary of the machines in the workspace.
type MachinesSummary struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
*MachinesSummaryProperties `json:"properties,omitempty"`
}
// MachinesSummaryProperties is summarizes machines in the workspace.
type MachinesSummaryProperties struct {
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
Total *int32 `json:"total,omitempty"`
Live *int32 `json:"live,omitempty"`
Os *MachineCountsByOperatingSystem `json:"os,omitempty"`
}
// Map is a map of resources and relationships between them.
type Map struct {
Nodes *MapNodes `json:"nodes,omitempty"`
Edges *MapEdges `json:"edges,omitempty"`
}
// MapEdges is the edges (relationships) of a map.
type MapEdges struct {
Connections *[]Connection `json:"connections,omitempty"`
Acceptors *[]Acceptor `json:"acceptors,omitempty"`
}
// MapNodes is the nodes (entities) of a map.
type MapNodes struct {
Machines *[]Machine `json:"machines,omitempty"`
Processes *[]Process `json:"processes,omitempty"`
Ports *[]Port `json:"Ports,omitempty"`
ClientGroups *[]ClientGroup `json:"ClientGroups,omitempty"`
}
// MapRequest is specifies the contents of request to generate a map.
type MapRequest interface {
AsSingleMachineDependencyMapRequest() (*SingleMachineDependencyMapRequest, bool)
AsMachineGroupMapRequest() (*MachineGroupMapRequest, bool)
}
func unmarshalMapRequest(body []byte) (MapRequest, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["kind"] {
case string(KindMapsingleMachineDependency):
var smdmr SingleMachineDependencyMapRequest
err := json.Unmarshal(body, &smdmr)
return smdmr, err
case string(KindMapmachineGroupDependency):
var mgmr MachineGroupMapRequest
err := json.Unmarshal(body, &mgmr)
return mgmr, err
default:
return nil, errors.New("Unsupported type")
}
}
func unmarshalMapRequestArray(body []byte) ([]MapRequest, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
mrArray := make([]MapRequest, len(rawMessages))
for index, rawMessage := range rawMessages {
mr, err := unmarshalMapRequest(*rawMessage)
if err != nil {
return nil, err
}
mrArray[index] = mr
}
return mrArray, nil
}
// MapResponse is specified the contents of a map response.
type MapResponse struct {
autorest.Response `json:"-"`
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
Map *Map `json:"map,omitempty"`
}
// NetworkConfiguration is describes the network configuration of a machine.
type NetworkConfiguration struct {
Ipv4Interfaces *[]Ipv4NetworkInterface `json:"ipv4Interfaces,omitempty"`
Ipv6Interfaces *[]Ipv6NetworkInterface `json:"ipv6Interfaces,omitempty"`
DefaultIpv4Gateways *[]string `json:"defaultIpv4Gateways,omitempty"`
MacAddresses *[]string `json:"macAddresses,omitempty"`
DNSNames *[]string `json:"dnsNames,omitempty"`
}
// OperatingSystemConfiguration is describes the configuration of the operating system of a machine.
type OperatingSystemConfiguration struct {
Family OperatingSystemFamily `json:"family,omitempty"`
FullName *string `json:"fullName,omitempty"`
Bitness Bitness `json:"bitness,omitempty"`
}
// Port is a port resource represents a server port on a machine. The port may be actively *monitored*, i.e., a
// Dependency Agent is running on its machine, or *discovered*, i.e., its existence was inferred by observing the data
// stream from monitored machines. A port is live during an interval of time, if that port had associated activity
// during (parts) of that interval.
type Port struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Etag *string `json:"etag,omitempty"`
Kind KindCoreResource `json:"kind,omitempty"`
*PortProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for Port.
func (p Port) MarshalJSON() ([]byte, error) {
p.Kind = KindPort
type Alias Port
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(p),
})
}
// AsMachine is the CoreResource implementation for Port.
func (p Port) AsMachine() (*Machine, bool) {
return nil, false
}
// AsProcess is the CoreResource implementation for Port.
func (p Port) AsProcess() (*Process, bool) {
return nil, false
}
// AsPort is the CoreResource implementation for Port.
func (p Port) AsPort() (*Port, bool) {
return &p, true
}
// AsClientGroup is the CoreResource implementation for Port.
func (p Port) AsClientGroup() (*ClientGroup, bool) {
return nil, false
}
// AsMachineGroup is the CoreResource implementation for Port.
func (p Port) AsMachineGroup() (*MachineGroup, bool) {
return nil, false
}
// PortCollection is collection of Port resources.
type PortCollection struct {
autorest.Response `json:"-"`
Value *[]Port `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// PortCollectionPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client PortCollection) PortCollectionPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// PortProperties is resource properties.
type PortProperties struct {
MonitoringState MonitoringState `json:"monitoringState,omitempty"`
Machine ResourceReference `json:"machine,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
IPAddress *string `json:"ipAddress,omitempty"`
PortNumber *int32 `json:"portNumber,omitempty"`
}
// UnmarshalJSON is the custom unmarshaler for PortProperties struct.
func (p *PortProperties) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
var v *json.RawMessage
v = m["monitoringState"]
if v != nil {
var monitoringState MonitoringState
err = json.Unmarshal(*m["monitoringState"], &monitoringState)
if err != nil {
return err
}
p.MonitoringState = monitoringState
}
v = m["machine"]
if v != nil {
machine, err := unmarshalResourceReference(*m["machine"])
if err != nil {
return err
}
p.Machine = machine
}
v = m["displayName"]
if v != nil {
var displayName string
err = json.Unmarshal(*m["displayName"], &displayName)
if err != nil {
return err
}
p.DisplayName = &displayName
}
v = m["ipAddress"]
if v != nil {
var IPAddress string
err = json.Unmarshal(*m["ipAddress"], &IPAddress)
if err != nil {
return err
}
p.IPAddress = &IPAddress
}
v = m["portNumber"]
if v != nil {
var portNumber int32
err = json.Unmarshal(*m["portNumber"], &portNumber)
if err != nil {
return err
}
p.PortNumber = &portNumber
}
return nil
}
// PortReference is reference to a port.
type PortReference struct {
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Kind Kind `json:"kind,omitempty"`
*PortReferenceProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for PortReference.
func (pr PortReference) MarshalJSON() ([]byte, error) {
pr.Kind = KindRefport
type Alias PortReference
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(pr),
})
}
// AsMachineReference is the ResourceReference implementation for PortReference.
func (pr PortReference) AsMachineReference() (*MachineReference, bool) {
return nil, false
}
// AsProcessReference is the ResourceReference implementation for PortReference.
func (pr PortReference) AsProcessReference() (*ProcessReference, bool) {
return nil, false
}
// AsPortReference is the ResourceReference implementation for PortReference.
func (pr PortReference) AsPortReference() (*PortReference, bool) {
return &pr, true
}
// AsMachineReferenceWithHints is the ResourceReference implementation for PortReference.
func (pr PortReference) AsMachineReferenceWithHints() (*MachineReferenceWithHints, bool) {
return nil, false
}
// PortReferenceProperties is resource properties.
type PortReferenceProperties struct {
Machine *MachineReference `json:"machine,omitempty"`
IPAddress *string `json:"ipAddress,omitempty"`
PortNumber *int32 `json:"portNumber,omitempty"`
}
// Process is a process resource represents a process running on a machine. The process may be actively *monitored*,
// i.e., a Dependency Agent is running on its machine, or *discovered*, i.e., its existence was inferred by observing
// the data stream from monitored machines. A process resource represents a pool of actual operating system resources
// that share command lines and metadata. As the process pool evolves over time, prior versions of the process resource
// are preserved and available for access. A process is live during an interval of time, if that process is executing
// during (parts) of that interval
type Process struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Etag *string `json:"etag,omitempty"`
Kind KindCoreResource `json:"kind,omitempty"`
*ProcessProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for Process.
func (p Process) MarshalJSON() ([]byte, error) {
p.Kind = KindProcess
type Alias Process
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(p),
})
}
// AsMachine is the CoreResource implementation for Process.
func (p Process) AsMachine() (*Machine, bool) {
return nil, false
}
// AsProcess is the CoreResource implementation for Process.
func (p Process) AsProcess() (*Process, bool) {
return &p, true
}
// AsPort is the CoreResource implementation for Process.
func (p Process) AsPort() (*Port, bool) {
return nil, false
}
// AsClientGroup is the CoreResource implementation for Process.
func (p Process) AsClientGroup() (*ClientGroup, bool) {
return nil, false
}
// AsMachineGroup is the CoreResource implementation for Process.
func (p Process) AsMachineGroup() (*MachineGroup, bool) {
return nil, false
}
// ProcessCollection is collection of Process resources.
type ProcessCollection struct {
autorest.Response `json:"-"`
Value *[]Process `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ProcessCollectionPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ProcessCollection) ProcessCollectionPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// ProcessDetails is describes process metadata.
type ProcessDetails struct {
PersistentKey *string `json:"persistentKey,omitempty"`
PoolID *int32 `json:"poolId,omitempty"`
FirstPid *int32 `json:"firstPid,omitempty"`
Description *string `json:"description,omitempty"`
CompanyName *string `json:"companyName,omitempty"`
InternalName *string `json:"internalName,omitempty"`
ProductName *string `json:"productName,omitempty"`
ProductVersion *string `json:"productVersion,omitempty"`
FileVersion *string `json:"fileVersion,omitempty"`
CommandLine *string `json:"commandLine,omitempty"`
ExecutablePath *string `json:"executablePath,omitempty"`
WorkingDirectory *string `json:"workingDirectory,omitempty"`
}
// ProcessProperties is resource properties.
type ProcessProperties struct {
Timestamp *date.Time `json:"timestamp,omitempty"`
MonitoringState MonitoringState `json:"monitoringState,omitempty"`
Machine ResourceReference `json:"machine,omitempty"`
ExecutableName *string `json:"executableName,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
StartTime *date.Time `json:"startTime,omitempty"`
Role ProcessRole `json:"role,omitempty"`
Details *ProcessDetails `json:"details,omitempty"`
User *ProcessUser `json:"user,omitempty"`
ClientOf ResourceReference `json:"clientOf,omitempty"`
AcceptorOf ResourceReference `json:"acceptorOf,omitempty"`
}
// UnmarshalJSON is the custom unmarshaler for ProcessProperties struct.
func (p *ProcessProperties) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
var v *json.RawMessage
v = m["timestamp"]
if v != nil {
var timestamp date.Time
err = json.Unmarshal(*m["timestamp"], &timestamp)
if err != nil {
return err
}
p.Timestamp = &timestamp
}
v = m["monitoringState"]
if v != nil {
var monitoringState MonitoringState
err = json.Unmarshal(*m["monitoringState"], &monitoringState)
if err != nil {
return err
}
p.MonitoringState = monitoringState
}
v = m["machine"]
if v != nil {
machine, err := unmarshalResourceReference(*m["machine"])
if err != nil {
return err
}
p.Machine = machine
}
v = m["executableName"]
if v != nil {
var executableName string
err = json.Unmarshal(*m["executableName"], &executableName)
if err != nil {
return err
}
p.ExecutableName = &executableName
}
v = m["displayName"]
if v != nil {
var displayName string
err = json.Unmarshal(*m["displayName"], &displayName)
if err != nil {
return err
}
p.DisplayName = &displayName
}
v = m["startTime"]
if v != nil {
var startTime date.Time
err = json.Unmarshal(*m["startTime"], &startTime)
if err != nil {
return err
}
p.StartTime = &startTime
}
v = m["role"]
if v != nil {
var role ProcessRole
err = json.Unmarshal(*m["role"], &role)
if err != nil {
return err
}
p.Role = role
}
v = m["details"]
if v != nil {
var details ProcessDetails
err = json.Unmarshal(*m["details"], &details)
if err != nil {
return err
}
p.Details = &details
}
v = m["user"]
if v != nil {
var userVar ProcessUser
err = json.Unmarshal(*m["user"], &userVar)
if err != nil {
return err
}
p.User = &userVar
}
v = m["clientOf"]
if v != nil {
clientOf, err := unmarshalResourceReference(*m["clientOf"])
if err != nil {
return err
}
p.ClientOf = clientOf
}
v = m["acceptorOf"]
if v != nil {
acceptorOf, err := unmarshalResourceReference(*m["acceptorOf"])
if err != nil {
return err
}
p.AcceptorOf = acceptorOf
}
return nil
}
// ProcessReference is reference to a process.
type ProcessReference struct {
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Kind Kind `json:"kind,omitempty"`
*ProcessReferenceProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for ProcessReference.
func (pr ProcessReference) MarshalJSON() ([]byte, error) {
pr.Kind = KindRefprocess
type Alias ProcessReference
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(pr),
})
}
// AsMachineReference is the ResourceReference implementation for ProcessReference.
func (pr ProcessReference) AsMachineReference() (*MachineReference, bool) {
return nil, false
}
// AsProcessReference is the ResourceReference implementation for ProcessReference.
func (pr ProcessReference) AsProcessReference() (*ProcessReference, bool) {
return &pr, true
}
// AsPortReference is the ResourceReference implementation for ProcessReference.
func (pr ProcessReference) AsPortReference() (*PortReference, bool) {
return nil, false
}
// AsMachineReferenceWithHints is the ResourceReference implementation for ProcessReference.
func (pr ProcessReference) AsMachineReferenceWithHints() (*MachineReferenceWithHints, bool) {
return nil, false
}
// ProcessReferenceProperties is resource properties.
type ProcessReferenceProperties struct {
Machine *MachineReference `json:"machine,omitempty"`
}
// ProcessUser is describes the user under which a process is running.
type ProcessUser struct {
UserName *string `json:"userName,omitempty"`
UserDomain *string `json:"userDomain,omitempty"`
}
// Relationship is a typed relationship between two entities.
type Relationship interface {
AsConnection() (*Connection, bool)
AsAcceptor() (*Acceptor, bool)
}
func unmarshalRelationship(body []byte) (Relationship, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["kind"] {
case string(KindRelconnection):
var c Connection
err := json.Unmarshal(body, &c)
return c, err
case string(KindRelacceptor):
var a Acceptor
err := json.Unmarshal(body, &a)
return a, err
default:
return nil, errors.New("Unsupported type")
}
}
func unmarshalRelationshipArray(body []byte) ([]Relationship, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
rArray := make([]Relationship, len(rawMessages))
for index, rawMessage := range rawMessages {
r, err := unmarshalRelationship(*rawMessage)
if err != nil {
return nil, err
}
rArray[index] = r
}
return rArray, nil
}
// RelationshipProperties is relationship properties.
type RelationshipProperties struct {
Source ResourceReference `json:"source,omitempty"`
Destination ResourceReference `json:"destination,omitempty"`
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
}
// UnmarshalJSON is the custom unmarshaler for RelationshipProperties struct.
func (rp *RelationshipProperties) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
var v *json.RawMessage
v = m["source"]
if v != nil {
source, err := unmarshalResourceReference(*m["source"])
if err != nil {
return err
}
rp.Source = source
}
v = m["destination"]
if v != nil {
destination, err := unmarshalResourceReference(*m["destination"])
if err != nil {
return err
}
rp.Destination = destination
}
v = m["startTime"]
if v != nil {
var startTime date.Time
err = json.Unmarshal(*m["startTime"], &startTime)
if err != nil {
return err
}
rp.StartTime = &startTime
}
v = m["endTime"]
if v != nil {
var endTime date.Time
err = json.Unmarshal(*m["endTime"], &endTime)
if err != nil {
return err
}
rp.EndTime = &endTime
}
return nil
}
// Resource is resource model definition.
type Resource struct {
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
}
// ResourceReference is represents a reference to another resource.
type ResourceReference interface {
AsMachineReference() (*MachineReference, bool)
AsProcessReference() (*ProcessReference, bool)
AsPortReference() (*PortReference, bool)
AsMachineReferenceWithHints() (*MachineReferenceWithHints, bool)
}
func unmarshalResourceReference(body []byte) (ResourceReference, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["kind"] {
case string(KindRefmachine):
var mr MachineReference
err := json.Unmarshal(body, &mr)
return mr, err
case string(KindRefprocess):
var pr ProcessReference
err := json.Unmarshal(body, &pr)
return pr, err
case string(KindRefport):
var pr PortReference
err := json.Unmarshal(body, &pr)
return pr, err
case string(KindRefmachinewithhints):
var mrwh MachineReferenceWithHints
err := json.Unmarshal(body, &mrwh)
return mrwh, err
default:
return nil, errors.New("Unsupported type")
}
}
func unmarshalResourceReferenceArray(body []byte) ([]ResourceReference, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
rrArray := make([]ResourceReference, len(rawMessages))
for index, rawMessage := range rawMessages {
rr, err := unmarshalResourceReference(*rawMessage)
if err != nil {
return nil, err
}
rrArray[index] = rr
}
return rrArray, nil
}
// SingleMachineDependencyMapRequest is specifies the computation of a single server dependency map. A single server
// dependency map includes all direct dependencies of a given machine.
type SingleMachineDependencyMapRequest struct {
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
Kind KindMapRequest `json:"kind,omitempty"`
MachineID *string `json:"machineId,omitempty"`
}
// MarshalJSON is the custom marshaler for SingleMachineDependencyMapRequest.
func (smdmr SingleMachineDependencyMapRequest) MarshalJSON() ([]byte, error) {
smdmr.Kind = KindMapsingleMachineDependency
type Alias SingleMachineDependencyMapRequest
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(smdmr),
})
}
// AsSingleMachineDependencyMapRequest is the MapRequest implementation for SingleMachineDependencyMapRequest.
func (smdmr SingleMachineDependencyMapRequest) AsSingleMachineDependencyMapRequest() (*SingleMachineDependencyMapRequest, bool) {
return &smdmr, true
}
// AsMachineGroupMapRequest is the MapRequest implementation for SingleMachineDependencyMapRequest.
func (smdmr SingleMachineDependencyMapRequest) AsMachineGroupMapRequest() (*MachineGroupMapRequest, bool) {
return nil, false
}
// Summary is base for all resource summaries.
type Summary struct {
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
}
// SummaryProperties is base for all summaries.
type SummaryProperties struct {
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
}
// Timezone is describes a timezone.
type Timezone struct {
FullName *string `json:"fullName,omitempty"`
}
// VirtualMachineConfiguration is describes the virtualizaton-related configuration of a machine.
type VirtualMachineConfiguration struct {
VirtualMachineType VirtualMachineType `json:"virtualMachineType,omitempty"`
NativeMachineID *string `json:"nativeMachineId,omitempty"`
VirtualMachineName *string `json:"virtualMachineName,omitempty"`
NativeHostMachineID *string `json:"nativeHostMachineId,omitempty"`
}