RPC context handles for HCN | Microsoft ·续

/// Return a list of existing namespaces

///

/// \param Query Optionally specifies a JSON document for a query

/// containing properties of the specific namespaces to

/// return. By default all Namespaces are returned.

/// \retval Namespaces Receives a JSON document with the list of namespaces.

/// \retval ErrorRecord Optional. Receives a JSON document on failure with extended result

/// information. The caller must release the buffer using

/// CoTaskMemFree.

///

/// \returns S_OK if successful; HResult error code on failures.

///

HRESULT

WINAPI

HcnEnumerateNamespaces(

In PCWSTR Query,

Outptr PWSTR* Namespaces,

Outptr_opt PWSTR* ErrorRecord

);

/// Create a Namespace

///

/// \param Id Specifies the unique ID for the new namespace.

/// \param Settings JSON document specifying the settings of the new namespace.

/// \retval Namespace Receives a handle to the new namespace.

/// \retval ErrorRecord Optional. Receives a JSON document on failure with extended result

/// information. The caller must release the buffer using

/// CoTaskMemFree.

///

/// \returns S_OK if successful; HResult error code on failures.

///

HRESULT

WINAPI

HcnCreateNamespace(

In REFGUID Id,

In PCWSTR Settings,

Out PHCN_NAMESPACE Namespace,

Outptr_opt PWSTR* ErrorRecord

);

/// Opens a handle to an existing namespace.

///

/// \param Id Unique ID of the existing namespace.

/// \retval Namespace Receives a handle to the namespace.

/// \retval ErrorRecord Optional. Receives a JSON document on failure with extended result

/// information. The caller must release the buffer using

/// CoTaskMemFree.

///

/// \returns S_OK if successful; HResult error code on failures.

///

HRESULT

WINAPI

HcnOpenNamespace(

In REFGUID Id,

Out PHCN_NAMESPACE Namespace,

Outptr_opt PWSTR* ErrorRecord

);

/// Modify the settings of a namespace

///

/// \param Namespace Handle to a namespace.

/// \param Settings JSON document specifying the new settings of the namespace.

/// \retval ErrorRecord Optional, receives a JSON document on failure with extended result

/// information. The caller must release the buffer using

/// CoTaskMemFree.

///

/// \returns S_OK if successful; HResult error code on failures.

///

HRESULT

WINAPI

HcnModifyNamespace(

In HCN_NAMESPACE Namespace,

In PCWSTR Settings,

Outptr_opt PWSTR* ErrorRecord

);

/// Query Namespace properties

///

/// \param Namespace Handle to a namespace.

/// \param Query Optionally specifies a JSON document for a query

/// containing specific properties of the namespace

/// return. By default all properties are returned.

/// \retval Properties Receives a JSON document with Namespace properties.

/// \retval ErrorRecord Optional. Receives a JSON document on failure with extended result

/// information. The caller must release the buffer using

/// CoTaskMemFree.

///

/// \returns S_OK if successful; HResult error code on failures.

///

HRESULT

WINAPI

HcnQueryNamespaceProperties(

In HCN_NAMESPACE Namespace,

In PCWSTR Query,

Outptr PWSTR* Properties,

Outptr_opt PWSTR* ErrorRecord

);

/// Delete a Namespace

///

/// \param Id Unique ID of the existing namespace.

/// \retval ErrorRecord Optional. Receives a JSON document on failure with extended result

/// information. The caller must release the buffer using

/// CoTaskMemFree.

///

/// \returns S_OK if successful; HResult error code on failures.

///

HRESULT

WINAPI

HcnDeleteNamespace(

In REFGUID Id,

Outptr_opt PWSTR* ErrorRecord

);

/// Close a handle to a Namespace

///

/// \param Namespace Handle to a namespace.

///

/// \returns S_OK if successful; HResult error code on failures.

///

HRESULT

WINAPI

HcnCloseNamespace(

In HCN_NAMESPACE Namespace

);


## HCN\_LoadBalancer

An HCN load balancer is an entity that's used to represent a host compute network load balancer. Load balancers allow you to have load balanced host compute network endpoints. HCN LoadBalancer entities are represented using HCN\_LOADBALANCER RPC context handles.

/// Handle to an operation

DECLARE_HANDLE(HCN_LOADBALANCER);

//////

/// LoadBalancer methods

/// Return a list of existing load balancers

///

/// \param Query Optionally specifies a JSON document for a query

/// containing properties of the specific load balancers to

/// return. By default all load balancers are returned.

/// \retval LoadBalancers Receives a JSON document with the list of load balancers.

/// \retval ErrorRecord Optional. Receives a JSON document with extended errorCode

/// information. The caller must release the buffer using

/// CoTaskMemFree.

///

/// \returns S_OK if successful; HResult error code on failures.

///

HRESULT

WINAPI

HcnEnumerateLoadBalancers(

In PCWSTR Query,

Outptr PWSTR* LoadBalancer,

Outptr_opt PWSTR* ErrorRecord

);

/// Create a load balancer

///

/// \param Id Specifies the unique ID for the new load balancer.

/// \param Settings JSON document specifying the settings of the new load balancer.

/// \retval LoadBalancer Receives a handle to the new LoadBalancer.

/// \retval ErrorRecord Optional. Receives a JSON document with extended errorCode

/// information. The caller must release the buffer using

/// CoTaskMemFree.

///

/// \returns S_OK if successful; HResult error code on failures.

///

HRESULT

WINAPI

HcnCreateLoadBalancer(

In REFGUID Id,

In PCWSTR Settings,

Out PHCN_LOADBALANCER LoadBalancer,

Outptr_opt PWSTR* ErrorRecord

);

/// Opens a handle to an existing LoadBalancer.

///

/// \param Id Unique ID of the existing load balancer.

/// \retval LoadBalancer Receives a handle to the load balancer.

/// \retval ErrorRecord Optional. Receives a JSON document with extended errorCode

/// information. The caller must release the buffer using

/// CoTaskMemFree.

///

/// \returns S_OK if successful; HResult error code on failures.

///

HRESULT

WINAPI

HcnOpenLoadBalancer(

In REFGUID Id,

Out PHCN_LOADBALANCER LoadBalancer,

Outptr_opt PWSTR* ErrorRecord

);

/// Modify the settings of a PolcyList

///

/// \param PolcyList Handle to a PolcyList.

/// \param Settings JSON document specifying the new settings of the PolcyList.

/// \retval ErrorRecord Optional, receives a JSON document with extended errorCode

/// information. The caller must release the buffer using

/// CoTaskMemFree.

///

/// \returns S_OK if successful; HResult error code on failures.

///

HRESULT

WINAPI

HcnModifyLoadBalancer(

In HCN_LOADBALANCER LoadBalancer,

In PCWSTR Settings,

Outptr_opt PWSTR* ErrorRecord

);

/// Query LoadBalancer properties

///

/// \param LoadBalancer Handle to a load balancer.

/// \param Query Optionally specifies a JSON document for a query

/// containing specific properties of the load balancer

/// return. By default all properties are returned.

/// \retval Properties Receives a JSON document with LoadBalancer properties.

/// \retval ErrorRecord Optional, receives a JSON document with extended errorCode

/// information. The caller must release the buffer using

/// CoTaskMemFree.

///

/// \returns S_OK if successful; HResult error code on failures.

///

HRESULT

WINAPI

HcnQueryLoadBalancerProperties(

In HCN_LOADBALANCER LoadBalancer,

In PCWSTR Query,

Outptr PWSTR* Properties,

Outptr_opt PWSTR* ErrorRecord

);

/// Delete a LoadBalancer

///

/// \param Id Unique ID of the existing load balancer.

/// \retval ErrorRecord Optional. Receives a JSON document with extended errorCode

/// information. The caller must release the buffer using

/// CoTaskMemFree.

///

/// \returns S_OK if successful; HResult error code on failures.

///

HRESULT

WINAPI

HcnDeleteLoadBalancer(

In REFGUID Id,

Outptr_opt PWSTR* ErrorRecord

);

/// Close a handle to a LoadBalancer

///

/// \param LoadBalancer Handle to a load balancer.

///

/// \returns S_OK if successful; HResult error code on failures.

///

HRESULT

WINAPI

HcnCloseLoadBalancer(

In HCN_LOADBALANCER LoadBalancer


## HCN\_Notification\_Callback

These functions provide access to service-wide operations such as notifications (for example, receiving notifications of a new network creation).

/// Registers a callback function to receive notifications of service-wide events such as network

/// creations/deletions.

///

/// \param Callback Function pointer to notification callback.

/// \param Context Context pointer.

/// \retval CallbackHandle Receives a handle to a callback registered on a service.

///

/// \returns S_OK if successful; HResult error code on failures.

///

HRESULT WINAPI

HcnRegisterServiceCallback(

In HCN_NOTIFICATION_CALLBACK Callback,

In void* Context,

Out HCN_CALLBACK* CallbackHandle

);

/// Unregisters from service-wide notifications

///

/// \retval CallbackHandle Handle to a callback registered on a service.

///

/// \returns S_OK if successful; HResult error code on failures.

///

HRESULT WINAPI

HcnUnregisterServiceCallback(

In HCN_CALLBACK CallbackHandle

);

```