Package org.jclouds.domain

Examples of org.jclouds.domain.Location


      Supplier<Set<? extends Location>> locations = Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet
               .<Location> of());
      Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of());
      Supplier<Set<? extends Hardware>> hardwares = Suppliers.<Set<? extends Hardware>> ofInstance(ImmutableSet
               .<Hardware> of());
      Location defaultLocation = createMock(Location.class);
      Provider<TemplateOptions> optionsProvider = createMock(Provider.class);
      Provider<TemplateBuilder> templateBuilderProvider = createMock(Provider.class);

      replay(defaultLocation);
      replay(optionsProvider);
View Full Code Here


      Supplier<Set<? extends Location>> locations = Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet
               .<Location> of());
      Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of());
      Supplier<Set<? extends Hardware>> hardwares = Suppliers.<Set<? extends Hardware>> ofInstance(ImmutableSet
               .<Hardware> of());
      Location defaultLocation = createMock(Location.class);
      Provider<TemplateOptions> optionsProvider = createMock(Provider.class);
      Provider<TemplateBuilder> templateBuilderProvider = createMock(Provider.class);

      replay(defaultLocation);
      replay(optionsProvider);
View Full Code Here

                expectedInventoryItemMetadata.put("targetProviderId", tConnectionProvider.getId());
                expectedInventoryItemMetadata.put("targetProviderDisplayName", tConnectionProvider.getDisplayName());
                expectedInventoryItemMetadata.put("targetProviderType", tConnectionProvider.getType());

                if (tInventoryItem.getConnection().getProviderId().equals(ProviderIdConstants.AWS_PROVIDER_ID)) {
                    Location zone = inventoryService.getLocationByScope(tInventoryItem, LocationScope.ZONE);
                    Location region = inventoryService.getLocationByScope(tInventoryItem, LocationScope.REGION);
                    Set<String> iso3166Codes = zone != null ? zone.getIso3166Codes() : null;
                    String iso3166Code = iso3166Codes != null && iso3166Codes.size() >= 1 ?
                            iso3166Codes.iterator().next() :
                            null;

                    if (tInventoryItem.getType().equals(Constants.COMPUTE_INSTANCE_TYPE)) {
                        expectedObjectMetadata.put("targetIP",
                                inventoryService.getComputeInstanceIPAddress(tInventoryItem));
                        expectedObjectMetadata.put("targetOS",
                                inventoryService.getComputeInstanceOSName(tInventoryItem));
                    }

                    if (iso3166Code != null) {
                        expectedObjectMetadata.put("targetISO3166Code", iso3166Code);
                    }
                    if (zone != null) {
                        expectedObjectMetadata.put("targetZone", zone.getId());
                    }
                    if (region != null) {
                        expectedObjectMetadata.put("targetRegion", region.getId());
                    }
                }

                validateEventMetadata(eventMetadata, expectedInventoryItemMetadata, true);
            } else if (expectedTarget instanceof Connection) {
View Full Code Here

        Preconditions.checkNotNull(scope, "scope cannot be null.");
        Preconditions.checkArgument(json.containsKey("location"), "json must contain a 'location' attribute.");

        JSONObject locationObject = json.containsKey("location") && json.get("location") != null ?
                json.getJSONObject("location") : null;
        Location location = null;

        while (locationObject != null) {
            if (locationObject.containsKey("scope")) {
                String locationScope = locationObject.getString("scope");
View Full Code Here

        inventoryItem.addHashtag(externalId);
        inventoryItem.addHashtag(internalType);

        // For all of AWS, we add hashtags for the availability zone and region
        Location region = getLocationByScope(json, LocationScope.REGION);
        Location zone = getLocationByScope(json, LocationScope.ZONE);

        if (region != null) {
            inventoryItem.addHashtag(region.getId());
        }
        if (zone != null) {
            inventoryItem.addHashtag(zone.getId());
        }

        // For AWS EC2, we add OS name
        if (externalType.equals(ComputeType.NODE.toString())) {
            String osName = getComputeInstanceOSName(json);
View Full Code Here

                    continue;
                }

                Map<String, JSONObject> metrics = new HashMap<>();
                String nodeId = inventoryItem.getExternalId();
                Location region = getLocationByScope(inventoryItem, LocationScope.REGION);

                if (region == null) {
                    continue;
                }

                String regionId = region.getId();
                Dimension dimension = new Dimension(EC2Constants.Dimension.INSTANCE_ID, nodeId);

                for (Map.Entry<String, Unit> ec2MetricEntry : ec2CloudWatchMetricNames.entrySet()) {
                    String metricName = ec2MetricEntry.getKey();
                    Unit metricUnit = ec2MetricEntry.getValue();
View Full Code Here

     */
    public String createBucket(OutboundConfiguration outboundConfiguration) throws InvalidCredentialsException {
        BlobStore s3BlobStore = getBlobStoreContext().getBlobStore();
        String bucketName = convertOutboundConnectionToBucketName(outboundConfiguration);

        Location location = null;
        if (StringUtils.hasText(outboundConfiguration.getDestination())) {
            LocationBuilder builder = new LocationBuilder();
            builder.id(outboundConfiguration.getDestination());
            builder.scope(LocationScope.REGION);
            builder.description(outboundConfiguration.getDestination());
View Full Code Here

        }

        assertNotNull(inventoryItemDTO);

        // Make sure the zone and region is accurate
        Location location = newNode.getLocation();
        boolean zoneMatches = false;
        boolean regionMatches = false;

        while (location != null) {
            JSONObject payload = JSONObject.fromObject(inventoryItemDTO.getPayload().toString());
            String region = inventoryService.getLocationByScope(payload, LocationScope.REGION).getId();
            String zone = inventoryService.getLocationByScope(payload, LocationScope.ZONE).getId();

            if (location.getScope() == LocationScope.REGION) {
                if (location.getId().equals(region)) {
                    regionMatches = true;
                }
            } else if (location.getScope() == LocationScope.ZONE) {
                if (location.getId().equals(zone)) {
                    zoneMatches = true;
                }
            }

            if (!zoneMatches || !regionMatches) {
                location = location.getParent();
            } else {
                break;
            }
        }
View Full Code Here

   }

   @Override
   public LoadBalancerMetadata apply(LoadBalancerInRegion input) {

      Location location = findLocationWithId(input.getRegion());

      return new LoadBalancerMetadataImpl(LoadBalancerType.LB, input.getName(), input.getName(), input.slashEncode(),
               location, null, ImmutableMap.<String, String> of(),
               ImmutableSet.of(input.getLoadBalancer().getDnsName()));
   }
View Full Code Here

   }

   @Override
   public SecurityGroup apply(org.jclouds.ec2.domain.SecurityGroup group) {
      SecurityGroupBuilder builder = new SecurityGroupBuilder();
      Location location = findLocationWithId(group.getRegion());
      builder.location(location);
      builder.id(group.getRegion() + "/" + idOrName(group));
      builder.providerId(group.getId());
      builder.name(group.getName());
      builder.ipPermissions(group);
View Full Code Here

TOP

Related Classes of org.jclouds.domain.Location

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.