@Target(value=TYPE) @Retention(value=RUNTIME) public @interface AzureHost
Host
, allowing endpoints
of AzureEnvironment
to be specified instead of string
host names. This allows self adaptive base URLs based on the environment the
client is running in.
Example 1: Azure Resource Manager
@AzureHost(AzureEnvironment.Endpoint.RESOURCE_MANAGER)
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: Azure Key Vault
@AzureHost(AzureEnvironment.Endpoint.KEY_VAULT)
interface KeyVaultService {
@GET("secrets/{secretName}")
Secret getSecret(@HostParam String vaultName, @PathParam("secretName") String secretName);
}Modifier and Type | Optional Element and Description |
---|---|
AzureEnvironment.Endpoint |
endpoint
The endpoint that all REST APIs within the Swagger interface will send their requests to.
|
String |
value
The endpoint that all REST APIs within the Swagger interface will send their requests to.
|
public abstract String value
public abstract AzureEnvironment.Endpoint endpoint
Copyright © 2020 Microsoft Corporation. All rights reserved.