Host Interface
Implements
public interface Host
implements Annotation
Annotation for parameterized host name targeting a REST service.
This is the 'host' field or 'x-ms-parameterized-host.hostTemplate' field in a Swagger document. parameters are enclosed in {}s, e.g. {accountName}. An HTTP client must accept the parameterized host as the base URL for the request, replacing the parameters during runtime with the actual values users provide.
For parameterized hosts, parameters annotated with HostParam must be provided. See Java docs in HostParam for directions for host parameters.
The host's value must contain the scheme/protocol and the host. The host's value may contain the port number.
Example 1: Static annotation
@Host("https://management.azure.com")
interface VirtualMachinesService {
@Get("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/"
+ "virtualMachines/{vmName}")
VirtualMachine getByResourceGroup(@PathParam("resourceGroupName") String rgName,
@PathParam("vmName") String vmName,
@PathParam("subscriptionId") String subscriptionId);
}
Example 2: Dynamic annotation
@Host("https://{vaultName}.vault.azure.net:443")
interface KeyVaultService {
@Get("secrets/{secretName}")
Secret get(@HostParam("vaultName") String vaultName, @PathParam("secretName") String secretName);
}
Method Summary
| Modifier and Type | Method and Description |
|---|---|
| abstract String |
value()
Get the protocol/scheme, host, and optional port number in a single string. |
Method Details
value
public abstract String value()
Get the protocol/scheme, host, and optional port number in a single string.
Returns: