Search in sources :

Example 1 with AuthorizationLevel

use of com.microsoft.azure.functions.annotation.AuthorizationLevel in project azure-tools-for-java by Microsoft.

the class FunctionNode method triggerHttpTrigger.

@AzureOperation(name = "function|trigger.start_http", params = { "this.functionApp.name()" }, type = AzureOperation.Type.TASK)
private void triggerHttpTrigger(FunctionEntity.BindingEntity binding) {
    final AuthorizationLevel authLevel = EnumUtils.getEnumIgnoreCase(AuthorizationLevel.class, binding.getProperty("authLevel"));
    String targetUrl;
    switch(authLevel) {
        case ANONYMOUS:
            targetUrl = getAnonymousHttpTriggerUrl();
            break;
        case FUNCTION:
            targetUrl = getFunctionHttpTriggerUrl();
            break;
        case ADMIN:
            targetUrl = getAdminHttpTriggerUrl();
            break;
        default:
            final String format = String.format("Unsupported authorization level %s", authLevel);
            throw new AzureToolkitRuntimeException(format);
    }
    DefaultLoader.getUIHelper().openInBrowser(targetUrl);
}
Also used : AuthorizationLevel(com.microsoft.azure.functions.annotation.AuthorizationLevel) AzureToolkitRuntimeException(com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException) AzureString(com.microsoft.azure.toolkit.lib.common.bundle.AzureString) AzureOperation(com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)

Aggregations

AuthorizationLevel (com.microsoft.azure.functions.annotation.AuthorizationLevel)1 AzureString (com.microsoft.azure.toolkit.lib.common.bundle.AzureString)1 AzureToolkitRuntimeException (com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException)1 AzureOperation (com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)1