The Hello World sample provides both management portal for administrator and management portal for tenants user interface extensions as well as the required endpoint implementations. As an MVC ASP.NET website based sample, controllers are used provide the endpoint definitions that allow access to the resource provider resources. They are also used to make calls to the Service Management API on behalf of the management portal user interface. The custom resource provider management portal administrator user interface extensions are expressed as views.

User Interface Extensions and Controllers

The sample user interface provides extensions for the management portal for administrators and the management portal for tenants. A client-side JavaScript based user interface is available through the Internet Explorer. The sample projects are:

Both controllers use HelloWorldClient.cs in Microsoft.WAP.Samples.HelloWorld.APIClient to route calls through the Service Management API to the Hello World custom resource provider.

Resource Provider Endpoint Implementation

The four REST endpoints are implemented as server-side controllers in the Hello World sample project, Microsoft.WAP.HelloWorld.API. There are 7 controllers representing the administrator and tenant endpoints. FileShareController.cs represents the tenant endpoint whilst the others represent the administrator endpoint.

The process by which a client-side management portal user activity results in a call to one of the resource provider endpoints is as follows. In this example, a tenant uses the custom management portal for tenants user interface extension to Quick Create a file share.

The tenant chooses to Quick Create a file share. Processed client-side In HelloWorldTenantController.js this results in a REST call server-side to CreateFileShare in HelloWorldTenantController.cs

CreateFileShare calls CreateFileShare in the api client helper class defined in HelloWorldClient.cs—Microsoft.WAP.Samples.HelloWorld.APIClient. This function does the work of building the URI for the Create File Share Tenant REST API call on the Hello World resource provider and making the call via the Service Management API.

The call to this.Post in CreateFileShare (HelloWorldClient.cs) sends the REST call, with accompanying file share name request body, to the Service Management API which routes the call to the Hello World custom resource provider.

The hello world custom provider tenant endpoint receives the create file share call in FileShareController.cs and performs the appropriate action.

Registering the Hello World Resource Provider

The hello world sample project Microsoft.WAP.Samples.HelloWorld.Setup provides an installer and registration for the customer provider. It is documented in Deploying a Windows Azure Pack Management Portal Extension. Specifically related to registering a custom resource provider is registering the endpoints with Windows Azure Pack. The hello world sample uses a Windows PowerShell script (Register-ResourceProvider.ps1) to register the custom resource provider endpoints. This gives Windows Azure Pack the necessary information to correctly pass REST calls through the Service Management API to the Hello World custom resource provider. In the script, Windows Azure Pack PowerShell cmdlets perform registration. The rpSettings parameter provides the necessary endpoint information used to register the endpoints and other configuration information.