Search in sources :

Example 41 with com.amazonaws.services.ec2.model

use of com.amazonaws.services.ec2.model in project xtext-core by eclipse.

the class Bug250313Test method testKeywordConversion_01.

@Test
public void testKeywordConversion_01() throws Exception {
    Model model = (Model) getModel("1 mykeyword1");
    assertEquals("mykeyword1", model.getValue());
    // XXX value converter is not called for keywords?
    // if this is a bug, all assertions 'assertEquals(1, convertCallCount)' have to be increased
    assertEquals(lexerRule, 0, convertCallCount);
}
Also used : Model(org.eclipse.xtext.valueconverter.bug250313.Model) Test(org.junit.Test)

Example 42 with com.amazonaws.services.ec2.model

use of com.amazonaws.services.ec2.model in project xtext-core by eclipse.

the class Bug250313Test method testDatatypeConversion_04.

@Test
public void testDatatypeConversion_04() throws Exception {
    Model model = (Model) getModel("1+ foo - bar");
    assertEquals("[str]", model.getMultiValue().toString());
    assertEquals("org.eclipse.xtext.valueconverter.Bug250313.Datatype", lexerRule);
    assertTrue(node instanceof ICompositeNode);
    assertEquals(6, Iterables.size(((ICompositeNode) node).getChildren()));
    assertEquals("foo - bar", string);
    assertEquals(1, convertCallCount);
}
Also used : Model(org.eclipse.xtext.valueconverter.bug250313.Model) ICompositeNode(org.eclipse.xtext.nodemodel.ICompositeNode) Test(org.junit.Test)

Example 43 with com.amazonaws.services.ec2.model

use of com.amazonaws.services.ec2.model in project xtext-core by eclipse.

the class Bug250313SemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == Bug250313Package.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case Bug250313Package.CHILD1:
                sequence_Child1(context, (Child1) semanticObject);
                return;
            case Bug250313Package.CHILD2:
                sequence_Child2(context, (Child2) semanticObject);
                return;
            case Bug250313Package.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) Model(org.eclipse.xtext.valueconverter.bug250313.Model) Parameter(org.eclipse.xtext.Parameter) Child2(org.eclipse.xtext.valueconverter.bug250313.Child2) Child1(org.eclipse.xtext.valueconverter.bug250313.Child1) EPackage(org.eclipse.emf.ecore.EPackage)

Example 44 with com.amazonaws.services.ec2.model

use of com.amazonaws.services.ec2.model in project ignite by apache.

the class TcpDiscoveryElbIpFinder method getRegisteredAddresses.

/**
 * {@inheritDoc}
 */
@Override
public Collection<InetSocketAddress> getRegisteredAddresses() throws IgniteSpiException {
    initClients();
    List<String> instanceIds = new ArrayList<>();
    DescribeLoadBalancersRequest req = new DescribeLoadBalancersRequest().withLoadBalancerNames(loadBalancerName);
    List<LoadBalancerDescription> descs = amazonELBClient.describeLoadBalancers(req).getLoadBalancerDescriptions();
    for (LoadBalancerDescription desc : descs) {
        for (Instance instance : desc.getInstances()) instanceIds.add(instance.getInstanceId());
    }
    DescribeInstancesRequest instReq = new DescribeInstancesRequest().withInstanceIds(instanceIds);
    List<Reservation> reservations = amazonEC2Client.describeInstances(instReq).getReservations();
    List<InetSocketAddress> addrs = new ArrayList<>();
    for (Reservation reservation : reservations) {
        List<com.amazonaws.services.ec2.model.Instance> instances = reservation.getInstances();
        for (com.amazonaws.services.ec2.model.Instance instance : instances) addrs.add(new InetSocketAddress(instance.getPrivateIpAddress(), 0));
    }
    return addrs;
}
Also used : Instance(com.amazonaws.services.elasticloadbalancing.model.Instance) InetSocketAddress(java.net.InetSocketAddress) ArrayList(java.util.ArrayList) DescribeInstancesRequest(com.amazonaws.services.ec2.model.DescribeInstancesRequest) DescribeLoadBalancersRequest(com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersRequest) Reservation(com.amazonaws.services.ec2.model.Reservation) LoadBalancerDescription(com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription)

Example 45 with com.amazonaws.services.ec2.model

use of com.amazonaws.services.ec2.model in project photon-model by vmware.

the class AWSDiskService method updateDiskState.

/**
 * Update photon-model disk state with the properties of ebs volume.
 */
private void updateDiskState(Volume volume, AWSDiskContext context, AwsDiskStage next) {
    DiskState diskState = context.disk;
    diskState.id = volume.getVolumeId();
    if (volume.getCreateTime() != null) {
        diskState.creationTimeMicros = TimeUnit.MILLISECONDS.toMicros(volume.getCreateTime().getTime());
    }
    diskState.status = DiskService.DiskStatus.AVAILABLE;
    diskState.origin = DiskService.DiskOrigin.DEPLOYED;
    diskState.encrypted = volume.getEncrypted();
    // calculate disk name, default to volume-id if 'Name' tag is not present
    if (diskState.name == null) {
        if (volume.getTags() == null) {
            diskState.name = volume.getVolumeId();
        } else {
            diskState.name = volume.getTags().stream().filter(tag -> tag.getKey().equals(AWS_TAG_NAME)).map(tag -> tag.getValue()).findFirst().orElse(volume.getVolumeId());
        }
    }
    diskState.zoneId = volume.getAvailabilityZone();
    sendRequest(Operation.createPatch(createInventoryUri(this.getHost(), context.diskRequest.resourceLink())).setBody(diskState).setCompletion((o, e) -> {
        if (e != null) {
            handleStages(context, e);
            return;
        }
        handleStages(context, next);
    }));
}
Also used : AuthCredentialsServiceState(com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState) DeleteVolumeResult(com.amazonaws.services.ec2.model.DeleteVolumeResult) OperationContext(com.vmware.xenon.common.OperationContext) Date(java.util.Date) DISK_IOPS(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.DISK_IOPS) AWSUtils.validateSizeSupportedByVolumeType(com.vmware.photon.controller.model.adapters.awsadapter.AWSUtils.validateSizeSupportedByVolumeType) DiskInstanceRequest(com.vmware.photon.controller.model.adapterapi.DiskInstanceRequest) AWS_VOLUME_ID_PREFIX(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.AWS_VOLUME_ID_PREFIX) ArrayList(java.util.ArrayList) CreateVolumeResult(com.amazonaws.services.ec2.model.CreateVolumeResult) MAX_IOPS_PER_GiB(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.MAX_IOPS_PER_GiB) Utils(com.vmware.xenon.common.Utils) CreateVolumeRequest(com.amazonaws.services.ec2.model.CreateVolumeRequest) BiConsumer(java.util.function.BiConsumer) Volume(com.amazonaws.services.ec2.model.Volume) DEVICE_TYPE(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.DEVICE_TYPE) AWSClientManager(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSClientManager) AdapterUtils(com.vmware.photon.controller.model.adapters.util.AdapterUtils) AWSAsyncHandler(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSAsyncHandler) StatelessService(com.vmware.xenon.common.StatelessService) AWS_TAG_NAME(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.AWS_TAG_NAME) AwsDiskClient(com.vmware.photon.controller.model.adapters.awsadapter.util.AwsDiskClient) Operation(com.vmware.xenon.common.Operation) TaskManager(com.vmware.photon.controller.model.adapters.util.TaskManager) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) UUID(java.util.UUID) VOLUME_TYPE(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.VOLUME_TYPE) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) List(java.util.List) AvailabilityZone(com.amazonaws.services.ec2.model.AvailabilityZone) DeleteVolumeRequest(com.amazonaws.services.ec2.model.DeleteVolumeRequest) AsyncHandler(com.amazonaws.handlers.AsyncHandler) PhotonModelConstants(com.vmware.photon.controller.model.constants.PhotonModelConstants) AWSClientManagerFactory(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSClientManagerFactory) AWS_DISK_REQUEST_TIMEOUT_MINUTES(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.AWS_DISK_REQUEST_TIMEOUT_MINUTES) DiskService(com.vmware.photon.controller.model.resources.DiskService) OperationJoin(com.vmware.xenon.common.OperationJoin) PhotonModelUriUtils.createInventoryUri(com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri) AmazonEC2AsyncClient(com.amazonaws.services.ec2.AmazonEC2AsyncClient) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState)

Aggregations

Test (org.junit.Test)60 Model (org.eclipse.xtext.valueconverter.bug250313.Model)30 ICompositeNode (org.eclipse.xtext.nodemodel.ICompositeNode)16 AmazonEC2Client (com.amazonaws.services.ec2.AmazonEC2Client)15 HashMap (java.util.HashMap)15 DescribeSubnetsResult (com.amazonaws.services.ec2.model.DescribeSubnetsResult)13 DescribeVpcsResult (com.amazonaws.services.ec2.model.DescribeVpcsResult)13 Vpc (com.amazonaws.services.ec2.model.Vpc)13 AuthenticatedContext (com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext)13 CloudContext (com.sequenceiq.cloudbreak.cloud.context.CloudContext)13 CloudStack (com.sequenceiq.cloudbreak.cloud.model.CloudStack)13 Group (com.sequenceiq.cloudbreak.cloud.model.Group)13 InstanceAuthentication (com.sequenceiq.cloudbreak.cloud.model.InstanceAuthentication)13 Location (com.sequenceiq.cloudbreak.cloud.model.Location)13 Network (com.sequenceiq.cloudbreak.cloud.model.Network)13 Subnet (com.sequenceiq.cloudbreak.cloud.model.Subnet)13 ILeafNode (org.eclipse.xtext.nodemodel.ILeafNode)11 Model (org.eclipse.xtext.parsetree.reconstr.bug299395.Model)9 SubModel (org.eclipse.xtext.parsetree.reconstr.bug299395.SubModel)9 BoolExpr (com.microsoft.z3.BoolExpr)7