Search in sources :

Example 6 with Action

use of com.amazonaws.services.elasticloadbalancingv2.model.Action in project be5 by DevelopmentOnTheEdge.

the class ResponseTest method sendAsRawJson.

// @Test
// public void sendErrorsAsJson() throws Exception {
// Action call = new Action("call", "test/path");
// response.sendErrorsAsJson(call);
// 
// verify(writer).append(doubleQuotes("{'value':{'arg':'test/path','name':'call'}}"));
// verify(writer).flush();
// }
@Test
public void sendAsRawJson() {
    Action call = new Action("call", "test/path");
    response.sendAsRawJson(call);
    verify(writer).append(doubleQuotes("{'arg':'test/path','name':'call'}"));
}
Also used : Action(com.developmentontheedge.be5.model.Action) Test(org.junit.Test) Be5ProjectTest(com.developmentontheedge.be5.test.Be5ProjectTest)

Example 7 with Action

use of com.amazonaws.services.elasticloadbalancingv2.model.Action in project be5 by DevelopmentOnTheEdge.

the class Menu method collectEntityContent.

private void collectEntityContent(Entity entity, String language, Meta meta, UserAwareMeta userAwareMeta, List<String> roles, boolean withIds, List<RootNode> out) {
    List<Query> permittedQueries = meta.getQueries(entity, roles);
    if (permittedQueries.isEmpty()) {
        return;
    }
    String title = meta.getTitle(entity, language);
    List<OperationNode> operations = generateEntityOperations(entity, meta, userAwareMeta, roles, withIds);
    if (operations.isEmpty()) {
        operations = null;
    }
    if (canBeMovedToRoot(permittedQueries, title, language, meta)) {
        // Query in the root, contains an action.
        Id id = null;
        Action action = ActionUtils.toAction(permittedQueries.get(0));
        boolean isDefault = permittedQueries.get(0).isDefaultView();
        if (withIds) {
            String queryTitle = getTitleOfRootQuery(permittedQueries, title, language, meta);
            id = new Id(entity.getName(), queryTitle);
        }
        out.add(RootNode.action(id, title, isDefault, action, operations));
    } else {
        // No query in the root, just inner queries.
        List<QueryNode> children = generateEntityQueries(permittedQueries, language, meta, withIds);
        Id id = new Id(entity.getName(), null);
        out.add(RootNode.container(id, title, children, operations));
    }
}
Also used : Action(com.developmentontheedge.be5.model.Action) Query(com.developmentontheedge.be5.metadata.model.Query)

Example 8 with Action

use of com.amazonaws.services.elasticloadbalancingv2.model.Action in project be5 by DevelopmentOnTheEdge.

the class DocumentGeneratorImpl method presentOperation.

private TableOperationPresentation presentOperation(Query query, Operation operation) {
    String visibleWhen = Operations.determineWhenVisible(operation);
    String title = userAwareMeta.getLocalizedOperationTitle(query.getEntity().getName(), operation.getName());
    // boolean requiresConfirmation = operation.isConfirm();
    boolean isClientSide = Operations.isClientSide(operation);
    Action action = null;
    if (isClientSide) {
        action = Action.call(Operations.asClientSide(operation).toHashUrl());
    }
    return new TableOperationPresentation(operation.getName(), title, visibleWhen, false, isClientSide, action);
}
Also used : Action(com.developmentontheedge.be5.model.Action) TableOperationPresentation(com.developmentontheedge.be5.model.TableOperationPresentation)

Example 9 with Action

use of com.amazonaws.services.elasticloadbalancingv2.model.Action in project cloudbreak by hortonworks.

the class AwsNativeLoadBalancerLaunchService method createListener.

private void createListener(ResourceCreationContext context, AwsListener listener) {
    CloudResource listenerResource;
    Optional<CloudResource> existingLoadBalancer = persistenceRetriever.retrieveFirstByTypeAndStatusForStack(ResourceType.ELASTIC_LOAD_BALANCER_LISTENER, CommonStatus.CREATED, context.getStackId());
    if (existingLoadBalancer.isPresent()) {
        listenerResource = existingLoadBalancer.get();
        LOGGER.info("Elastic load balancer listener resource has already been created for stack proceeding forward with existing resource '{}'", listenerResource.getReference());
    } else {
        String loadBalancerArn = context.getLoadBalancerArn();
        String targetGroupArn = context.getTargetGroupArn();
        LOGGER.info("Creating listener for load balancer('{}') on target group('{}')", loadBalancerArn, targetGroupArn);
        Action defaultAction = new Action().withType(ActionTypeEnum.Forward).withOrder(1).withTargetGroupArn(targetGroupArn);
        CreateListenerRequest listenerRequest = new CreateListenerRequest().withLoadBalancerArn(loadBalancerArn).withProtocol(ProtocolEnum.TCP).withPort(listener.getPort()).withDefaultActions(defaultAction).withTags(context.getTags());
        CreateListenerResult registerListenerResult = createOrGetListener(context, listenerRequest);
        String listenerArn = registerListenerResult.getListeners().stream().findFirst().orElseThrow().getListenerArn();
        listenerResource = new CloudResource.Builder().name(context.getTargetGroupName()).type(ResourceType.ELASTIC_LOAD_BALANCER_LISTENER).reference(listenerArn).status(CommonStatus.CREATED).instanceId(loadBalancerArn).build();
        context.getPersistenceNotifier().notifyAllocation(listenerResource, context.getCloudContext());
    }
    CloudResourceStatus cloudResourceStatus = new CloudResourceStatus(listenerResource, ResourceStatus.CREATED);
    context.addResourceStatus(cloudResourceStatus);
}
Also used : Action(com.amazonaws.services.elasticloadbalancingv2.model.Action) CreateListenerRequest(com.amazonaws.services.elasticloadbalancingv2.model.CreateListenerRequest) CloudResourceStatus(com.sequenceiq.cloudbreak.cloud.model.CloudResourceStatus) CreateListenerResult(com.amazonaws.services.elasticloadbalancingv2.model.CreateListenerResult) CloudResource(com.sequenceiq.cloudbreak.cloud.model.CloudResource)

Example 10 with Action

use of com.amazonaws.services.elasticloadbalancingv2.model.Action in project be5 by DevelopmentOnTheEdge.

the class Menu method generateEntityOperations.

private List<OperationNode> generateEntityOperations(Entity entity, Meta meta, UserAwareMeta userAwareMeta, List<String> roles, boolean withIds) {
    List<OperationNode> operations = new ArrayList<>();
    Query allRecords = entity.getQueries().get(DatabaseConstants.ALL_RECORDS_VIEW);
    String insertOperationName = INSERT_OPERATION;
    if (allRecords != null && allRecords.getOperationNames().getFinalValues().contains(insertOperationName)) {
        Operation insertOperation = entity.getOperations().get(insertOperationName);
        if (insertOperation != null && meta.isAvailableFor(insertOperation, roles)) {
            String title = userAwareMeta.getLocalizedOperationTitle(entity.getName(), insertOperationName);
            Action action = ActionUtils.toAction(DatabaseConstants.ALL_RECORDS_VIEW, insertOperation);
            OperationId id = withIds ? new OperationId(entity.getName(), insertOperationName) : null;
            OperationNode operation = new OperationNode(id, title, action);
            operations.add(operation);
        }
    }
    return operations;
}
Also used : Action(com.developmentontheedge.be5.model.Action) Query(com.developmentontheedge.be5.metadata.model.Query) ArrayList(java.util.ArrayList) Operation(com.developmentontheedge.be5.metadata.model.Operation)

Aggregations

Action (com.developmentontheedge.be5.model.Action)10 Be5ProjectTest (com.developmentontheedge.be5.test.Be5ProjectTest)7 Test (org.junit.Test)7 Response (com.developmentontheedge.be5.api.Response)4 Action (com.amazonaws.services.elasticloadbalancingv2.model.Action)2 Query (com.developmentontheedge.be5.metadata.model.Query)2 CreateListenerRequest (com.amazonaws.services.elasticloadbalancingv2.model.CreateListenerRequest)1 CreateListenerResult (com.amazonaws.services.elasticloadbalancingv2.model.CreateListenerResult)1 DescribeListenersRequest (com.amazonaws.services.elasticloadbalancingv2.model.DescribeListenersRequest)1 Listener (com.amazonaws.services.elasticloadbalancingv2.model.Listener)1 Operation (com.developmentontheedge.be5.metadata.model.Operation)1 TableOperationPresentation (com.developmentontheedge.be5.model.TableOperationPresentation)1 ForIntent (com.google.actions.api.ForIntent)1 TransactionDecision (com.google.actions.api.response.helperintent.transactions.v3.TransactionDecision)1 Action (com.google.api.services.actions_fulfillment.v2.model.Action)1 GooglePaymentOption (com.google.api.services.actions_fulfillment.v2.model.GooglePaymentOption)1 LineItemV3 (com.google.api.services.actions_fulfillment.v2.model.LineItemV3)1 Location (com.google.api.services.actions_fulfillment.v2.model.Location)1 MerchantPaymentMethod (com.google.api.services.actions_fulfillment.v2.model.MerchantPaymentMethod)1 MerchantPaymentOption (com.google.api.services.actions_fulfillment.v2.model.MerchantPaymentOption)1