@Target(value=TYPE) @Retention(value=RUNTIME) public @interface Host
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);
}public abstract String value
Copyright © 2019 Microsoft Corporation. All rights reserved.